[fxruby-users] FXTextField and text alignment

Philippe Lang philippe.lang at attiksystem.ch
Wed Jul 2 11:32:32 EDT 2008


Jeroen van der Zijp wrote:
> On Wednesday 02 July 2008, Philippe Lang wrote:
>> Hi,
>> 
>> When the text inside an FXTextField is larger that the available
>> space, the FXTextField apparently "switches" from left alignment to
>> right aligment: you only see the end of the text. When the text is
>> smaller than the available space, text is aligned on the left.
>> 
>> Is there a way to change that, and have left alignment all the time?
>> I've been trying a few things, like LAYOUT_SIDE_LEFT or LAYOUT_LEFT,
>> but without success.
> 
> It does not switch; however, when putting text in the field, the
> cursor is placed at the end inside the field, which may cause a
> scroll to make this position visible.  
> 
> So, simply call textfield->moveCursor(0) to jump the cursor back; or
> call 
> textfield->makePositionVisible(0) to scroll but leave the cursor
> textfield->position
> at the original place...

Thanks a lot Jeroen. I'm calling textfield->makePositionVisible(0) each
time I assign something to the textfield, and everything is fine now.
The text is aligned to the left.

Regards,

Philippe


More information about the fxruby-users mailing list