[Solved] Framewindow inner rect problem

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

fedyakin
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Thu Apr 17, 2008 06:13
Location: Arizona, United States of America

[Solved] Framewindow inner rect problem

Postby fedyakin » Thu Sep 24, 2009 18:40

I'm experiencing a problem with frame windows that appears to be inner rect related. When the window is first show, it does not appear to account for the titlebar when calculating the inner rect. If the window is moved and then deactivated the area is closer to correct. Resizing it results in the expected area. Hopefully the following pictures make clear the problem.
First Shown:
Image
Moved:
Image
Resized:
Image

The behavior occurs with both the AquaLook and TaharezLook schemes, so it doesn't seem to be related to the skin being used. I've tried using setArea() and invalidate() on the windows after loading the layout, but that had no effect. Is anyone experiencing a similar problem?

CEGUI Log:
11:11:09.234(0688)@INFO:CEGUI@ ---- Version 0.7.0 (Build: Sep 22 2009 Debug Microsoft Windows MSVC++ 8.0 32 bit) ----
11:11:09.234(0688)@INFO:CEGUI@ ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
11:11:09.234(0688)@INFO:CEGUI@ ---- XML Parser module is: CEGUI::TinyXMLParser - Official tinyXML based parser module for CEGUI ----
11:11:09.250(0688)@INFO:CEGUI@ ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
11:11:09.250(0688)@INFO:CEGUI@ ---- Scripting module is: None ----
Last edited by fedyakin on Fri Sep 25, 2009 17:29, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Framewindow inner rect problem

Postby CrazyEddie » Thu Sep 24, 2009 20:27

Hi,

I just ran a quick test, but did not reproduce the issue. Can you tell us if you're creating the layout in code or via XML, if via XML can you post the XML (or PM if you don't want to post publicly). Also is the frame window being rendered to a texture target or a normal viewport type target.

Cheers,

CE.

fedyakin
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Thu Apr 17, 2008 06:13
Location: Arizona, United States of America

Re: Framewindow inner rect problem

Postby fedyakin » Thu Sep 24, 2009 20:58

The interface should be rendering to a viewport target (its using the default constructor of CEGUI::OgreRenderer). I think the frame window is rendering to a texture though because AutoRenderingSurface is true for FrameWindow in the looknfeel file. Changing that property had no effect.

The window is from the following layout. We make use of the PropertyCallback to loadWindowLayout, so you might have to comment out a property or two to use the layout. (As an aside, I was impressed by the foresight in that feature :) )

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<GUILayout >
    <Window Type="TaharezLook/FrameWindow" Name="DevelopmentWin" >
        <Property Name="SaveVis" Value="True" />
        <Property Name="Visible" Value="False" />
        <Property Name="AlwaysOnTop" Value="True" />
        <Property Name="CloseButtonEnabled" Value="False" />
        <Property Name="Text" Value="Interface Development" />
        <Property Name="UnifiedAreaRect" Value="{{1,-349},{0,63},{1,0},{0,313}}" />
        <Window Type="TaharezLook/MultiLineEditbox" Name="DevelopmentWin_Result" >
            <Property Name="ReadOnly" Value="True" />
            <Property Name="Text" Value="
"/> <!-- This newline is a workaround for a bug in multiline editboxes.  Don't remove it until that's fixed -->
            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{.5,-3}}" />
        </Window>
        <Window Type="TaharezLook/MultiLineEditbox" Name="DevelopmentWin_Command" >
            <Property Name="MaxTextLength" Value="300" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{.5,3},{1,0},{1,-40}}" />
        </Window>
        <Window Type="TaharezLook/Button" Name="DevelopmentWin_Reload" >
            <Property Name="Tooltip" Value="Reload the entire UI, including scripts and layout files" />
            <Property Name="Text" Value="Reload" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{1,-40},{0,110},{1,0}}" />
        </Window>
        <Window Type="TaharezLook/Button" Name="DevelopmentWin_Game" >
            <Property Name="Tooltip" Value="Load the UI in Game mode" />
            <Property Name="Text" Value="G" />
            <Property Name="UnifiedAreaRect" Value="{{0.5,-50},{1,-40},{0.5,0},{1,0}}" />
        </Window>
        <Window Type="TaharezLook/Button" Name="DevelopmentWin_Startup" >
            <Property Name="Text" Value="S" />
            <Property Name="Tooltip" Value="Load the UI in Startup mode" />
            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{1,-40},{0.5,50},{1,0}}" />
        </Window>
        <Window Type="TaharezLook/Button" Name="DevelopmentWin_Execute" >
            <Property Name="Tooltip" Value="Execute the entered script" />
            <Property Name="Text" Value="Execute" />
            <Property Name="UnifiedAreaRect" Value="{{1,-110},{1,-40},{1,0},{1,0}}" />
        </Window>
    </Window>
</GUILayout>

fedyakin
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Thu Apr 17, 2008 06:13
Location: Arizona, United States of America

Re: Framewindow inner rect problem

Postby fedyakin » Fri Sep 25, 2009 01:52

I believe I have figured out how to reproduce the problem. It occurs if the framewindow is never sized while visible. In the layout file above, the framewindow's 'Visible' property is set to false, and the window is shown in response to a key press.

In case it helps, the following snippet after loading a layout causes the window to be drawn as expected...

Code: Select all

const bool wasVisible = window->isVisible();
window->show();
const CEGUI::URect oldArea = window->getArea();
window->setArea(CEGUI::URect(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0), CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
window->setArea(oldArea);
window->setVisible(wasVisible);

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Framewindow inner rect problem

Postby CrazyEddie » Fri Sep 25, 2009 08:31

Hi, thanks for posting the layout and other info; I'll test it out and get back to you about it, though basically it seems that somewhere we're not invalidating the cached area rects when we should be.

We make use of the PropertyCallback to loadWindowLayout ... I was impressed by the foresight in that feature :)

Thanks, this was put in after a feature request from a user some years back, since then it's proven useful in many scenarios :)

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Framewindow inner rect problem

Postby CrazyEddie » Fri Sep 25, 2009 13:41

Ok. This issue is fixed in svn branc v0-7 r2265.

Interesting point here: while for child content the issue only manifests itself in 0.7.0 because of the inner rect / client area fix in that release, the actual bug (checking titlebar visibility instead of the correct option setting) has been present for many years - so nice find :)

CE.

fedyakin
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Thu Apr 17, 2008 06:13
Location: Arizona, United States of America

Re: Framewindow inner rect problem

Postby fedyakin » Fri Sep 25, 2009 17:29

That was fast, thanks :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 35 guests