Ecere SDK/eC Forums • View topic - Number alignment




Ecere SDK/eC Forums

Ecere Developers Community

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.

Number alignment

Postby shakeshuck » Thu Dec 03, 2015 4:13 am

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?
shakeshuck
 
Posts: 42
Joined: Tue Dec 01, 2015 6:52 pm

Re: Number alignment

Postby jerome » Thu Dec 03, 2015 8:52 am

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: 622
Joined: Sat Jan 16, 2010 11:16 pm

Re: Number alignment

Postby jerome » Thu Dec 03, 2015 9:51 am

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
jerome
Site Admin
 
Posts: 622
Joined: Sat Jan 16, 2010 11:16 pm


Return to GUI Toolkit & 2D Graphics

Who is online

Users browsing this forum: No registered users and 3 guests

cron