Number alignment

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.
Post Reply
shakeshuck
Posts: 31
Joined: Tue Dec 01, 2015 6:52 pm

Number alignment

Post by shakeshuck »

OK, next question - you'll be getting sick of me soon :o

I can't find any alignment attached to editbox or savingdatabox. Is it only in listbox?
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Number alignment

Post by jerome »

Feel free to ask questions, this is what these forums are for, and we realize the documentation is lacking. By the way, we're hoping to address that very soon, but we're awaiting switching over to a text format for the .eCdoc files that store the API documentation, so that it is easier to collaborate and track documentation changes with Git. This is being worked on right now.

DataField used by DropBox/ListBox have an alignment property.
That alignment defaults to a type's defaultAlignment, which is something I realize we never use anywhere anymore. To set it would require directly accessing the class object (class(MyType).defaultAlignment = right) at initialization. This should work with a DataBox
as well.

EditBox does not have any alignment property at this point.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Number alignment

Post by jerome »

Hi again,

After testing it out, turns out that defaultAlignment doesn't help much with anything at all regarding DataBox, probably why it isn't used anywhere ;)

What does work to edit right-aligned numbers (e.g. currency, see extras/types/Currency.ec) or text, is creating a DataBox with 'autoSize' set to true, and anchor it to the right (anchor = { right = XX }).

With this it might be desirable to set the background color of the DataBox to the same as its background, and set borderStyle to none, so that it looks as though it is right aligned in a parent control (you may want to define an extra parent window with a deep border for it).

Cheers,

Jerome
Post Reply