Autosize labels, cells, etc

Autosize labels, cells, etc

Forum member · Dec 5, 2005
Hello, Is there anyway to allow labels or table cells to adjust depending on how much text is put into a label or table cell? Or do I need to set an exact size for all labels or table cells? If I need to set an exact size for all labels or table cells then how do I keep things dynamic? I do not know how much text is going to be coming from the source? Thanks

Re: Autosize labels, cells, etc

Support · Dec 5, 2005
Hello, Yes, the cells within the table expand dynamically depending on the text that gets added to it. Using TextArea in place of Labels will allow you to handle dynamic text more efficiently. Depending on the text coming from the source, you can dynamically calculate the height required for that text using the getRequiredHeight() method of the TextArea class. This will give you proper position on where to start your next element from. Thanks, ceTe Software Support Team

Re: Autosize labels, cells, etc

Forum member · Dec 5, 2005
Thanks. I'll give that a shot. What about table columns? Can you do something like: Enter some text and force it to be one line. Then have the table column adjust accordingly.

Re: Autosize labels, cells, etc

Support · Dec 5, 2005
Hello, In order to force the text to fit in one line, you have to calculate the width of the text first before setting the column width. Font class has a getTextWidth() method which accepts the text and the font size and based on that will return the width required for the text supplied. Then you can set your column width equal to the value returned by the getRequiredWidth() method. Thanks, ceTe Software Support Team

Re: Autosize labels, cells, etc

Forum member · Dec 5, 2005
Thanks!