Hi all.
Could someone tell me how to load multiple layouts into one guisheet?
Assume you have two .layout files, one containing projectspecific (menus for the game etc...) stuff and the other contains more general stuff (console, messagewindows etc)
Now if I do:
Window *l1 = loadLayout("game.layout");
Window *l2 = loadLayout("system.layout");
Now I want to merge these two:
I could do:
l1->addChildWindow(l2);
or l2->addChildWIndow(l1);
or
Window *w = new GUISheet()
w->addChildWindow(l1);
w->addChildWindow(l2);
Now all these approaches fails on the following point:
- Only the last added layout can be interacted with.
The content of both layouts is visible, but only the windows in the last added layout reacts to mouse events. That is only the last windows can be made active.
Now I just realized that the reason for this is that the Root window (created by CELayouteditor) is actually of size 1,1, that is it obscures the whole window. This means that the root of the last added window will obscure anything loaded previously.
The root of evil here is then CElayouteditor, which dont allow you to save a layout without a root window (you cant delete the root window).
So layouteditor is a tool to only create full layouts, not partial ones.
If one edit the resulting layoutfiles and removes the root window, it actually works.
It should be possible to store a layout without the root, or just to make it possible to remove the root from the scene in Layouteditor
/A
Loading multiple layouts - CElayouteditor not working?
Moderators: CEGUI MVP, CEGUI Team
I've created multiple dialogs in various .layout files. When creating a new one I would start by adding a FrameWindow and then immediately saving and then closing the Layout Editor. I would then open up the .layout file in Notepad and manually remove the Root entry, making the FrameWindow the top level object. Then I reopen the .layout within the Layout Editor and continue designing as you normally would.
One thing to keep in mind when "activating" multiple .layout files is that every widget must have a unique name. The latest version of the Layout Editor makes that bit easy; the name of a new widget has the name of its parent as a prefix, in a hierarchy:
MyFrameWindowName
MyFrameWindowName/ButtonOk
MyFrameWindowName/ButtonCancel
One thing to keep in mind when "activating" multiple .layout files is that every widget must have a unique name. The latest version of the Layout Editor makes that bit easy; the name of a new widget has the name of its parent as a prefix, in a hierarchy:
MyFrameWindowName
MyFrameWindowName/ButtonOk
MyFrameWindowName/ButtonCancel
You can rename it though.
But I agree, it should be possible to load a layout even if there are windows with the same name.
Its after you have added it to an active root it becomes a problem.
But CEGUI is designed from the core that every window has to have a unique name, otherwise it becomes hard to locate a window created earlier. So I guess this is something that has to be accepted.
But I agree, it should be possible to load a layout even if there are windows with the same name.
Its after you have added it to an active root it becomes a problem.
But CEGUI is designed from the core that every window has to have a unique name, otherwise it becomes hard to locate a window created earlier. So I guess this is something that has to be accepted.
scriptkid wrote:I think that the 'Save Selection' button can be abused to re-save a layout without its root window.
Jeez, why didn't I think of that...
scriptkid wrote:[Edit] As a more constructive reply: would it be an idea to prompt whether you want a root window when you start a new layout? [/edit]
I would suggest the following instead. Never create a root window and open the Layout Editor blank. Then the user can either create a FrameWindow or a DefaultWindow (to be named Root or root). However I'm not thinking neutrally; I never use the root window so feel hindered by it. I wonder how many enjoy/benefit from having that root DefaultWindow.
Who is online
Users browsing this forum: No registered users and 4 guests