Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating size needed for text #154

Open
RudolfVonKrugstein opened this issue Jul 29, 2014 · 4 comments
Open

Calculating size needed for text #154

RudolfVonKrugstein opened this issue Jul 29, 2014 · 4 comments

Comments

@RudolfVonKrugstein
Copy link
Contributor

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

@RealyUniqueName
Copy link
Owner

Actually Floating widget should automatically adjust to size of content. Can you show your code?

@RudolfVonKrugstein
Copy link
Contributor Author

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...

@RealyUniqueName
Copy link
Owner

Now i got it )
You cant create text field with full text initially and after creation set it to blank string.

@RudolfVonKrugstein
Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants