[Gambas-user] TextWidth
Doriano Blengino
doriano.blengino at ...1909...
Fri Sep 3 07:39:25 CEST 2010
Fabián Flores Vadell ha scritto:
> When I try to adjust the width of a TextBox to its content, I use
> txtSomeThing.Width = txtSomeThing.TextWidth(txtSomeThing.Text). But
> doing that, the width of TextBox never be enought to show its content
> completely.
>
> I tried to find a correction factor but this is a fallible method. How
> I can adjust exactly the width of a TextBox to its content?
>
The width of a widget refers to its outside width, including
decorations. The interior width is a different thing, sometimes called
ClientWidth; but I don't know if Gambas TextBoxes have a ClientWidth
property. The size of the decorations should be always the same (in a
given theme). I don't know how to calculate it but, supposed that this
is possible and this is "8", something like
txtSomeThing.Width = 8 + txtSomeThing.TextWidth(txtSomeThing.Text)
could work, but I am not sure.
Regards,
Doriano
More information about the User
mailing list