How to set dynamically the maxSize of a TextField according to its width?

344 views Asked by At

There is a TextField inside a Container and other components in the Form. According to the available space for the Container the TextField has a preferred width. How can I set programmatically a maxSize , that is the maximum number of characters that can be entered , to the TextField ?

1

There are 1 answers

3
Mun0n On

For set a maximum number of characters to a TextField you should use setDefaultMaxSize(int value). So, you must catch the width of the Container and set this maxSize according to this size.