Search code examples
javahtmllayoutformattingzk

Text cut off in panel box (ZK/HTML)


I'm having a bit of trouble with some formatting using ZK (which is roughly analogous to HTML). I'm using a program that automatically adds text to the box titled "privDesc". Normally this works fine--it puts it on one line normally, and more if necessary. However, for certain lengths of strings (say, 71-73 characters), the text is instead cut off at the end at it doesn't roll over to the next line. I've tried changing the hbox-width for the relevant hbox, but no luck. Anyone have any thoughts?

<zk>
<window id="X" use="X" border="none" width="500px" height="650px" mode="overlapped" closable="true" position="center,center">
    <include src="X"/>
    <vbox style= "margin-left: 18px;margin-top:18px;margin-right:20px;height:210px;" >
        <label value="Add an access rule" style="font-size:28px !important;color:#0018A8" />
        <label style="color: #666666 !important;font-size:13px !important;" value="X"/>
        <separator spacing="15px" />
        <hbox spacing="0">
            <cell   style="valign=center;border-right: none;border-left: none;border-bottom: none;border-top: none"  width="200px">
                <label style="color: #666666 !important" value="X"/>
            </cell>
            <cell  style=";border-right: none;border-left: none;border-bottom: none;border-top: none"  width="230px">
                <combobox id="comboBoxPriv" width="230px" style="background: #FFFFFF;" readonly="true"/>
            </cell>
        </hbox>
        <panel height="30px" width="500px">
            <panelchildren style="margin-left: 18px; margin-right: 40px; width">
                <hbox width="325px" pack="center" align="center"><label id="privDesc"/></hbox>
            </panelchildren>
        </panel>

Solution

  • You can change the panel part like this:

    <panel height="min" width="500px">
        <panelchildren style="margin-left: 18px; margin-right: 40px; width">
            <hbox width="325px" pack="center" align="center">
                <label id="privDesc" hyphen="true"/>
            </hbox>
        </panelchildren>
    </panel>
    

    First, the label now has the property hyphen="true" which make that when the value of the label is too long it is display in multiple lines (but only works if you have spaces into the value, if not then it does not split it)

    Second, your first panel has the property height="min", that's because if you put a fixed value (like height="30px") then when the label is display in multiple lines it is cut, but with height="min" the label is well displayed and the panel just take as much as it needs.

    Label multiline and panel height min