Ecere SDK/eC Forums
http://ecere.org/community/
Print view

Number alignment
http://ecere.org/community/viewtopic.php?f=5&t=409
Page 1 of 1
Author:  shakeshuck [ Thu Dec 03, 2015 4:13 am ]
Post subject:  Number alignment

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?
Author:  jerome [ Thu Dec 03, 2015 8:52 am ]
Post subject:  Re: Number alignment

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.
Author:  jerome [ Thu Dec 03, 2015 9:51 am ]
Post subject:  Re: Number alignment

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
All times are UTC-05:00 Page 1 of 1