[Solved] Function WindowManager::getWindow won't work

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

nuks
Just popping in
Just popping in
Posts: 2
Joined: Thu Oct 30, 2008 17:15
Contact:

[Solved] Function WindowManager::getWindow won't work

Postby nuks » Thu Oct 30, 2008 17:36

Hi,
first, sorry for my bad english ;-)

I have a strange problem with the function CEGUI::WindowManager::getWindow(const String &name) const.

Here is my code:

Code: Select all

CEGUI::WindowManager* WindowMgr = mGUIManager.getWindowManager();
mGUIManager.setRootWindow(WindowMgr->loadWindowLayout("nubitor.layout", "Root")); // = setGuiSheet()
CEGUI::PushButton* quitButton = (CEGUI::PushButton*)WindowMgr->getWindow("[b]Root/Menu/Quit[/b]"); // Here is the problem.
quitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&VDrawer2D::onButton_Quit, this));


CEGUI return me these exeptions:
CEGUI Exception: WindowManager::getWindow - A Window object with the name 'Root/Menu/Quit' does not exist within the system
terminate called after throwing an instance of 'CEGUI::UnknownObjectException'


Of course i have this in my XML layout:

Code: Select all

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

<GUILayout >
    <Window Type="DefaultWindow" Name="Root" >
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="WindowsLook/FrameWindow" Name="Root/Menu" >
            <Property Name="Text" Value="Menu" />
            <Property Name="TitlebarFont" Value="Commonwealth-10" />
            <Property Name="SizingEnabled" Value="False" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="TitlebarEnabled" Value="True" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.21875,0},{1,0}}" />
            <Property Name="DragMovingEnabled" Value="False" />
            <Property Name="CloseButtonEnabled" Value="False" />
            <Window Type="WindowsLook/Button" Name="Root/Menu/Quit" >
                <Property Name="Text" Value="Quit" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.9,0},{0.9,0},{0.95,0}}" />
            </Window>
            <Window Type="WindowsLook/Button" Name="[b]Root/Menu/Save[/b]" >
                <Property Name="Text" Value="Save" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.85,0},{0.9,0},{0.9,0}}" />
            </Window>
            <Window Type="WindowsLook/Button" Name="Root/Menu/Open" >
                <Property Name="Text" Value="Open" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.8,0},{0.9,0},{0.85,0}}" />
            </Window>
        </Window>
    </Window>
</GUILayout>


I would be verry happy if you could help me :p
Thank.
Last edited by nuks on Thu Oct 30, 2008 18:10, edited 1 time in total.

nuks
Just popping in
Just popping in
Posts: 2
Joined: Thu Oct 30, 2008 17:15
Contact:

Postby nuks » Thu Oct 30, 2008 18:09

I just found the solution ! :D
It's simply

Code: Select all

WindowMgr->loadWindowLayout("nubitor.layout");

and not

Code: Select all

WindowMgr->loadWindowLayout("nubitor.layout", "Root");


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests