Page 1 of 1

LayoutContainer, wrong child position (bug or feature?)

Posted: Fri Apr 10, 2015 11:16
by TheSHEEEP
I am using LayoutContainers for layout in a widget of mine.

Here is the XML of the widget:

Code: Select all

<GUILayout version="4" >
    <Window type="DefaultWindow" name="Console_LuaTab" >
        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Property name="Text" value="Lua Scripting" />
        <Property name="MaxSize" value="{{1,0},{1,0}}" />
        <Window type="VerticalLayoutContainer" name="LuaTabMainVert" >
            <Property name="Area" value="{{0,0},{0,0},{0,1600},{0,1200}}" />
            <Window type="HorizontalLayoutContainer" name="HorizontalLayoutContainer" >
                <Property name="Area" value="{{0,0},{0,0},{0,1600},{0,600}}" />
                <Window type="Vanilla/MultiLineEditbox" name="LuaTextEdit" >
                    <Property name="Area" value="{{0,0},{0,0},{0.8,0},{0.5,0}}" />
                    <Property name="Text" >
</Property>
                </Window>
                <Window type="VerticalLayoutContainer" name="VerticalLayoutContainer" >
                    <Property name="Area" value="{{0,1280},{0,0},{0,1600},{0,240}}" />
                    <Window type="Vanilla/Button" name="SubmitButton" >
                        <Property name="Area" value="{{0,0},{0,0},{0.2,0},{0.2,0}}" />
                        <Property name="Text" value="Submit" />
                        <Property name="VerticalAlignment" value="Centre" />
                    </Window>
                </Window>
            </Window>
            <Window type="Vanilla/MultiLineEditbox" name="LuaOutputTextEdit" >
                <Property name="Area" value="{{0,0},{0,600},{1,0},{0.5,600}}" />
                <Property name="Text" >
</Property>
                <Property name="ReadOnly" value="true" />
                <Property name="BlinkCaret" value="true" />
            </Window>
        </Window>
    </Window>
</GUILayout>

Basically, we have a vertical container (A) that contains a horizontal container (B) and an Editbox (D).
In B, there is another Editbox (C) and another vertical container (E).
In E, there is a Button (F) set to centered vertical alignment.

Here is how I expect this to look (basically, Qt behaviour):
Image

And here is how it does look:
Image

The problem seems to be that the vertical container E uses the full window size instead of the size it actually should have (constrained to the height of horizontal container B).
Or, I do not understand how it is supposed to work.
Again, what I was expecting was Qt behaviour, where each layout does its layouting work in relation to its parent (which might be another layout), not to the size of the "root" window itself.
So this might be a bug or a feature ;)

Re: LayoutContainer, wrong child position (bug or feature?)

Posted: Sat Apr 11, 2015 18:51
by Ident
Not that it makes a difference for this issue but the verticallayout conainer around the SubmitButton is unnecessary:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<GUILayout version="4" >
    <Window type="DefaultWindow" name="Console_LuaTab" >
        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Property name="Text" value="Lua Scripting" />
        <Property name="MaxSize" value="{{1,0},{1,0}}" />
        <Window type="VerticalLayoutContainer" name="LuaTabMainVert" >
            <Property name="Area" value="{{0,0},{0,0},{0,1280},{0,720}}" />
            <Window type="HorizontalLayoutContainer" name="HorizontalLayoutContainer" >
                <Property name="Area" value="{{0,0},{0,0},{0,1280},{0,360}}" />
                <Window type="Vanilla/MultiLineEditbox" name="LuaTextEdit" >
                    <Property name="Area" value="{{0,0},{0,0},{0.8,0},{0.5,0}}" />
                    <Property name="Text" >
</Property>
                </Window>
                <Window type="Vanilla/Button" name="SubmitButton" >
                    <Property name="Area" value="{{0,1024},{0,0},{0.2,1024},{0.2,0}}" />
                    <Property name="Text" value="Submit" />
                    <Property name="VerticalAlignment" value="Centre" />
                </Window>
            </Window>
            <Window type="Vanilla/MultiLineEditbox" name="LuaOutputTextEdit" >
                <Property name="Area" value="{{0,0},{0,360},{1,0},{0.5,360}}" />
                <Property name="Text" >
</Property>
                <Property name="ReadOnly" value="true" />
                <Property name="BlinkCaret" value="true" />
            </Window>
        </Window>
    </Window>
</GUILayout>



- If I resize LuaOutputTextEdit the parent LuaTabMainVert ( VerticalLayoutContainer) resizes correctly, just as expected
- If i resize LuaTextEdit to a relative height of 0,8 it also does the right thing and exceeds the host window
- If i try to position SubmitButton in whatever way that triggers relative coordinates to be used in some way (such as centre instead of top/right or a relative positional coordinate along X or Y) it indeed uses the Root windows size.

To me this is not a feature but a bug.

Do you wanna have the honor to create an issue for this in the bug-tracker?

Re: LayoutContainer, wrong child position (bug or feature?)

Posted: Sat Apr 11, 2015 19:23
by TheSHEEEP
Done: https://bitbucket.org/cegui/cegui/issue ... tcontainer

Good to know it is not necessary, thanks :)
Though it might become so if I add more at that location, of course.