Page 1 of 1

A Window object ... does not exist within the system

Posted: Thu Jan 11, 2007 00:49
by TMichael66
My code (straight from the Ogre's Basic Tutorial 6 about CEGUI) compiles cleanly, but the application crashes after loading the window at runtime. I am using VC++ 8.0 and Windows XP Home.

Here is the XML file:

Code: Select all

<?xml version="1.0" ?>
<GUILayout>
    <Window Type="DefaultWindow" Name="Tutorial Gui">
        <Window Type="TaharezLook/Button" Name="Quit">
             <Property Name="AbsoluteRect" Value="l:224.000000 t:216.000000 r:416.000000 b:264.000000" />
             <Property Name="RelativeRect" Value="l:0.350000 t:0.450000 r:0.650000 b:0.550000" />
             <Property Name="Text" Value="Quit" />
             </Window>
        </Window>
</GUILayout>


Here is the section of code in createscene where I load the layout:

Code: Select all

mEditorGuiSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"Tutorial Gui.xml");
      mGUISystem->setGUISheet(mEditorGuiSheet);
      CEGUI::PushButton* quitButton = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"Quit");


And here are the last few lines of the CEGUI log:


09/01/2007 17:39:53 (InfL2) ---- Resource loading for GUI scheme 'TaharezLookSkin' completed ----
09/01/2007 17:39:53 (InfL2) ---- Beginning loading of GUI layout from 'Tutorial Gui.xml' ----
09/01/2007 17:39:53 (InfL1) ---- Successfully completed loading of GUI layout from 'Tutorial Gui.xml' ----
09/01/2007 17:39:53 (Error) Exception: WindowManager::getWindow - A Window object with the name 'Quit' does not exist within the system


The xml seems to be loading, but the window name it defines is not being recognized. I copied every CEGUI file included with Ogre into my working directory just to make sure that wasn't the issue. Any idea what I am missing here?

Posted: Thu Jan 11, 2007 08:35
by scriptkid
Hi and welcome :-)

Okay so without the crashing line you see a button on screen, right? Your code looks fine, so you might add some tracing by adding something like this (prints all window names):

Code: Select all

WindowManager::WindowIterator it =  CEGUI::WindowManager::getSingleton().getIterator();
for(; !it.isAtEnd() ; ++it) {
  const char* windowName = it.getCurrentValue()->getName().c_str();
  printf("Name: %s\n", windowName);
}


to see if it is in the list...

If you don't have a console, just put a breakpoint at the 'printf' to see what's in 'windowName'.

Good luck!