StablexUI
StablexUI copied to clipboard
Calculating size needed for text
Hey,
I have a text widget embeded in a floating widget I want to display as an overlay over everything else. How want the size of the widgets to be such that the complete text can be displayed at once, but the widgets are no bigger than needed for that.
The text is not displayed completly when the widgets appear, but is gradually added later. But it is know beforehand what the complete text will be.
Can I somehow calculate the size (assuming for example a given width) the widget will need and set it correctly?
Thanks! Nathan
Actually Floating
widget should automatically adjust to size of content. Can you show your code?
Hey,
In pseudo code, this is what I want to do:
var textDisplay = UIBuilder.buildFn('gui/textDisplay.xml');
var text = UIBuilder.getAs(Text, "text");
haxe.Timer.delay(text.text += "Hello", 100);
haxe.Timer.delay(text.text += "World", 200);
(...)
the text display is a "Text" widget contained in a "VBox". The "VBox" grows as text is added, but I want it to have full size from the beginning...
Now i got it ) You cant create text field with full text initially and after creation set it to blank string.
mmh, that does not seem to work. At what point is the containing widget resized? And isn't it re-resized when I set the text to blank?