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

Make Text grow with container, but not shrink to much #192

Open
RudolfVonKrugstein opened this issue Mar 9, 2015 · 2 comments
Open

Make Text grow with container, but not shrink to much #192

RudolfVonKrugstein opened this issue Mar 9, 2015 · 2 comments

Comments

@RudolfVonKrugstein
Copy link
Contributor

Can I configure a "Text" widget, so that it grows in width with the container Widget (a VBox), but also forces the container to not shrink below a minimum size (so that it is always able to contain the complete text)?

<VBox id ="'container'">
  <Text .../>
  <MoreWidgets .../>
</VBox>

When I set widthPt="100" on the Text Widget, it does not enforce the container to grow, when the text does not fit anymore.
When I do not set "widthPt" the Text widget seems to have a fixed size, which exactly with the text.

@RealyUniqueName
Copy link
Owner

you need to handle resize event of container. E.g. like this:

<VBox on-resize="
    if ($this.w >= minSize) {
        //resize text widget
    }    
">
...
</VBox>

@RudolfVonKrugstein
Copy link
Contributor Author

I see, thanks.
I would prefer to do this in the "on-resize" of the text widget (because it feels more like a property of the text widget).
Can I access the "w" and "h" parameters of the on-resize function in xml?

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