Roberto
Roberto

Reputation: 1351

StackLayoutPanel height

I'm using the following code in gwt:

<g:DockLayoutPanel unit='EM'>
    <g:north size='5'>
        <g:Label>www.wing-project.org</g:Label>
    </g:north>
    <g:west size='10'>
        <g:StackLayoutPanel unit='EM'>
            <g:stack>
                <g:header size='3'>
                    Monitor
                </g:header>
                <g:HTMLPanel>
                    Overview
                </g:HTMLPanel>
            </g:stack>
            <g:stack>
                <g:header size='3'>
                    Configure
                </g:header>
                <g:HTMLPanel>
                    link
                </g:HTMLPanel>
            </g:stack>
            <g:stack>
                <g:header size='3'>
                    Help
                </g:header>
                <g:HTMLPanel />
            </g:stack>
        </g:StackLayoutPanel>
    </g:west>
    <g:center>
        <g:HTMLPanel>
            <g:Button ui:field="button" />
        </g:HTMLPanel>
    </g:center>
</g:DockLayoutPanel>

This produces an header a left pane with the stacklayout and a main pane with the actual content. The issue is that the left pane with the stacklayout takes all the verticale space available while I would like to have a stacklayoutpanel whose vertical size depends on the amount of text visualized in the active stack.

Is this compatible with how the stacklayoutpanel is supposed to work? If so, how can I achieve the goal?

Upvotes: 0

Views: 852

Answers (1)

Riley Lark
Riley Lark

Reputation: 20890

You can manually set the size of the StackLayoutPanel, but you will have to calculate what size that should be yourself - perhaps using relevantStackWidget.getOffsetHeight(). This can be pretty tricky, because for some elements getOffsetHeight() will return different values depending on what stage of animation the StackLayoutPanel is in.

There's no way to get this to behave like you want with the current GWT API alone.

Upvotes: 1

Related Questions