Page 1 of 1

[solved]A child window layout problem in 0.7.0

Posted: Sat Sep 26, 2009 07:52
by zhaosili
Hi,
When I load a child window with the following layout, the position goes wrong.

Code: Select all

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

<GUILayout >
    <Window Type="DefaultWindow" Name="Avatar" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{1,-120},{1,-142},{1,0},{1,0}}" />
        <Property Name="ClippedByParent" Value="False" />
        <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound" >
            <Property Name="FrameEnabled" Value="False" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="ClippedByParent" Value="False" />
            <Property Name="UnifiedAreaRect" Value="{{0,-10},{0,0},{1,-10},{1,0}}" />
            <Property Name="BackgroundEnabled" Value="False" />
            <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound/Frame" >
                <Property Name="FrameEnabled" Value="False" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
                <Property Name="BackgroundEnabled" Value="False" />
                <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound/Frame/Char" >
                    <Property Name="FrameEnabled" Value="False" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
                    <Property Name="BackgroundEnabled" Value="False" />
                </Window>
            </Window>
        </Window>
    </Window>
</GUILayout>


When I use the following code to add a child window, the position is not correct.

Code: Select all

      ava=winMgr.loadWindowLayout("avatar.layout",parent->getName()+CEGUI::String("/"));
      parent->addChildWindow(ava);


After I add the following line, it works.

Code: Select all

      ava->setPosition(UVector2(UDim(0,0),UDim(0,0)));



Further more, if I use the following layout, I don't find a suitable solution to get it work.
But the following layout works with CEGUI 0.6.2.

Code: Select all

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

<GUILayout >
    <Window Type="DefaultWindow" Name="Avatar" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,-10},{0,0},{1,-10},{1,0}}" />
        <Property Name="UnifiedWidth" Value="{0,120}" />
        <Property Name="UnifiedHeight" Value="{0,142}" />
        <Property Name="ClippedByParent" Value="False" />
        <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound" >
            <Property Name="FrameEnabled" Value="False" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="ClippedByParent" Value="False" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
            <Property Name="BackgroundEnabled" Value="False" />
            <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound/Frame" >
                <Property Name="FrameEnabled" Value="False" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
                <Property Name="BackgroundEnabled" Value="False" />
                <Window Type="TaharezLook/StaticImage" Name="Avatar/Backgound/Frame/Char" >
                    <Property Name="FrameEnabled" Value="False" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
                    <Property Name="BackgroundEnabled" Value="False" />
                </Window>
            </Window>
        </Window>
    </Window>
</GUILayout>


Re: A child window layout problem in 0.7.0

Posted: Sat Sep 26, 2009 08:47
by CrazyEddie
Hi,

When I use the following code to add a child window, the position is not correct.

What precisely does "the position is not correct" mean? In what way is it incorrect?
Also, what is the window type of parent? And does parent have the AutoRenderingSurface property set to true (or is backed by some other CEGUI::RenderingWindow)?

With regards to the second layout, again if you could let us know the specifics of the issue that would be great :)

I have to ask all the questions because until I know what I'm supposed to be looking for I can't hope to test anything.

If you are able to post screenshots or other images that visually show the correct and incorrect variants, that would be really helpful.

CE.

Re: A child window layout problem in 0.7.0

Posted: Sat Sep 26, 2009 09:07
by zhaosili
Hi,

"Incorrect" means that the position is reset to (0,0) under absolute axis.
A parent window is something like this:

Code: Select all

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

<GUILayout >
    <Window Type="DefaultWindow" Name="UserInfo" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="DefaultWindow" Name="UserInfo/Ava" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0,50},{0,50},{0.532265,50},{1,5}}" />
        </Window>
     </Window>
</GUILayout>

I use "UserInfo/Ava" as the parent window and I doesn't change any Property after loading the above layout.

For the second layout in the first post

Code: Select all

<Window Type="DefaultWindow" Name="Avatar" >
      <Property Name="UnifiedAreaRect" Value="{{0,-10},{0,0},{1,-10},{1,0}}" />
       <Property Name="UnifiedWidth" Value="{0,120}" />
       <Property Name="UnifiedHeight" Value="{0,142}" />
...

"Avatar" should appear at (50-10,50)=(40,50) as upper-left point under absolute axis if it's a child of "UserInfo/Ava".
But in fact, it appears at (0,0).
I think the problem is related to boundary check, it seems that the position is reset to (0,0) for minus values, not accounting the position of the parent window.

Re: A child window layout problem in 0.7.0

Posted: Sat Sep 26, 2009 11:23
by CrazyEddie
Thanks for the explanation - I'm not quite sure how I managed to break this, but I should be able to look into this later on this afternoon :lol:

CE.

Re: A child window layout problem in 0.7.0

Posted: Sat Sep 26, 2009 20:15
by CrazyEddie
I've run a test with the parent window layout and the first child window layout. In my test everything appears as I would have expected - I have posted a colourised and annotated image of what I got below. If this is correct, there must be something else affecting things at your end, if the image is "incorrect" (as far as what you were expecting), your expectations are incorrect ;) Please let me know either way...

Image

Btw, if I include the line

Code: Select all

ava->setPosition(UVector2(UDim(0,0),UDim(0,0)));

the Avatar window (and it's children) moves from the lower right to the upper left.

I did not test the second child layout, since I want to be sure that our understanding of the first one is the same before I expend more time on it :)

CE.

Re: A child window layout problem in 0.7.0

Posted: Sun Sep 27, 2009 17:35
by zhaosili
Hi,
my expected result is after including the line:

Code: Select all

ava->setPosition(UVector2(UDim(0,0),UDim(0,0)));

that is, the Avatar window (and it's children) is at the upper left.

I achieved this by two step, the result of first step is your image.
And the second step is including the above line of code, and that's my expected result:

Image

But I can not get the expected result using the 2nd layout in one step, that is, not using the above line of code.
When I load the 2nd layout directly, I expect the result to be the following:
Image
But I get the following unexpected result in fact:

Image

Re: A child window layout problem in 0.7.0

Posted: Sun Sep 27, 2009 19:17
by CrazyEddie
Ah, right now I think I understand - the first layout is essentially a work around - or at least means to demonstrate the real issue, which is the second layout problem. Ok. Now I 'get' what I'm looking for, I can test it properly ;) Give me an hour or so and I'll get back to you...

CE.

Re: A child window layout problem in 0.7.0

Posted: Sun Sep 27, 2009 20:22
by CrazyEddie
Just a note to confirm this is a bug :D I should get it fixed tomorrow morning (not doing it tonight, as even CE needs his sleep!)

CE.

Re: A child window layout problem in 0.7.0

Posted: Mon Sep 28, 2009 09:25
by CrazyEddie
Ok, this one should now be fixed in v0-7 branch.

CE.

Re: A child window layout problem in 0.7.0

Posted: Mon Sep 28, 2009 11:39
by zhaosili
It works now, thank you.

zhaosili