If you set the data type to e.g. float for a ListBox field, the data will normally be displayed with the alignment you setup for that field. But only when editing that data, it will be left-aligned.
This could be a work around for now, if you want the editing to be e.g. right-aligned as well.
Code: Select all
class MyFloat : float
{
Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
{
EditBox editor = (EditBox)class::OnEdit(dataBox, obsolete, x, y, w, h, userData);
editor.anchor = { top = 2, right = -4 };
editor.autoSize = true;
editor.OnPostCreate();
return editor;
}
}
However, this requires a tweak in DataBox.ec, otherwise the DataBox will currently unset that autoSize property if autoSize is not set on the DataBox itself (and auto-size DataBox don't work well with the ListBox):
Code: Select all
if(autoSize) // Need to add this if check
((EditBox)editor).autoSize = autoSize;
This is the line in the source:
https://github.com/ecere/ecere-sdk/blob ... ox.ec#L132
Then this should work:
Code: Select all
DataField fld3 { dataType = class(MyFloat), alignment = right, width = 120, editable = true };