cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Width for controls

Was wondering if it was feasible to have an auto width option similar to the auto height for some of the controls like a label or a text input box so that I can vary the width of the control according to the text in it according to some predefined conditions.

Status: New
Comments
Level 10

This is already possible by making the Width property of the control a function.

For example you can make the Width property of Label1 as this:

20*Len(Label1.Text)

Please try it

Level: Powered On

Hi Meneghino,

 

Thank you. I had actually already tried this, but the issue is if there is no text available in say a text input box then the width would be 0. Also as in the case of auto height, was trying to check the possibility of avoiding formulae

Level 10

Hi @ashwath12

Please try this:

If(Len(TextInput1.Text)=0, 20, 20*Len(TextInput1.Text))

With formulas you are much more in control of what happens.

Level: Powered On

Thanks a lot Meneghino.

Level 10

You are welcome @ashwath12

Level: Powered On

Still, some letters are smaller then others, so the amount of letters is not always an accurate way to establish the width of a button. I would still very much prefer an 'autowidth'.

Level: Power Up

Yes, exactly that - since the width of letters are different, all you can do is guess at this. Would be much better to just be able to set the width to auto.

Level 10

The AutoWidth for labels is something I am really looking forward to because it is the only way for us to create multilingual applications where labels are aside (like on a toolbar) and their individual length can vary a lot according to the language.