0

Calculate window size from children

asked 2016-05-18 12:52:25 +0800

imosescu gravatar image imosescu
1

Is there any way that a window takes only as much space as its children need?

<?page id="econfirmDialog"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./ecDialog"?>


<window id="ecDialog" title="${resolver.nls.mes_hdEmptyCompleteDialogTitle}"
    closable="true" sizable="true" mode="modal" border="normal"
    apply="com.camline.skmes.mes.webgui.controller.dialog.EmptyCompleteDialogController">

    <borderlayout>
        <center style="padding: 5px 5px;">
            <vbox vflex="min" align="center" pack="center">
                <label id="confirmText" style="font-size:150%;"/>
            </vbox>
        </center>

    </borderlayout>
</window>

Right now, I only see the title bar and it allocates no space for the actual content (borderlayout). I want the window to be just as big as to fit the text, however long the text may be. I tried setting vflex="min" and hflex="min" but it doesn't change anything.

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-05-19 06:08:22 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2016-05-19 06:08:38 +0800

You made the mistake b setting the vflex="min" to the wrong component.
Please try this :

<window id="ecDialog" title="testWindow"
closable="true" sizable="true" mode="modal" border="normal" vflex="min">
    <borderlayout>
        <center style="padding: 5px 5px;" vflex="min" hflex="1">
            <vbox align="center" pack="center">
               <label id="confirmText" style="font-size:150%;" value="test case" hflex="1"/>
            </vbox>
        </center>
    </borderlayout>
</window>

Link to fiddle where you can see the result of this zul.

Greetz chill.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-05-18 12:52:25 +0800

Seen: 22 times

Last updated: May 19 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More