Page 1 of 1

Organising xml files

Posted: Tue Jul 15, 2008 15:23
by sipickles
If I have understood it correctly, the best way to manage lots of windows is to have them all in one .layout file, then use setGUIsheet or the visible property to controll which are visible.

My problem is, when I have many many windows, my layout file gets a bit unwieldy.

Is there any way to load a layout as children of an existing window? Then I could make a root with several invisible children each loading a separate layout file.

Thanks

Si

Posted: Tue Jul 15, 2008 16:14
by Jamarr
You can have multiple/separate layouts loaded into the same GUISheet. It'll just be something like this:

Code: Select all

CEGUI::Window* pRoot = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "Root");
CEGUI::Window* pWin1 = CEGUI::WindowManager::getSingleton().loadWindowLayout(sWin1);
CEGUI::Window* pWin2 = CEGUI::WindowManager::getSingleton().loadWindowLayout(sWin2);


The important thing to keep in mind is that you cannot load two windows with the same name. If you are using the CELayoutEditor it creates a "Root" window in each layout file, so if you try to load two layout files who both have a window called "Root" it will fail. You can get around this by simply removing/renaming the "Root" window in each layout file. You may also be able to assign a unique prefix to each layout when loading it, though you'll have to track that prefix if you need to access the windows/elements by name later on.

Posted: Tue Jul 15, 2008 18:52
by sipickles
Thanks,

thats great, no big rewrite required! :wink: