Alternative to setGUISheet?

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

User avatar
Duck
Just popping in
Just popping in
Posts: 9
Joined: Sun Apr 30, 2006 17:15

Alternative to setGUISheet?

Postby Duck » Sun May 21, 2006 19:55

So far, I've managed to get a few main UI screens working. I can click buttons and go forward and backward between them.

I now want to be able to show modal message boxes over the top, for instance an 'Are you sure? Yes/No' window. I'd like the main menu screen to still be visible in the background, but be unresponsive.

I'm switching main menu screens by calling:

Code: Select all

   CEGUI::System::getSingleton().setGUISheet( sheet );


If I use this for my message box, the message box appears, but I lose the menu behind.

I tried to remove my calls to setGUISheet, in the hope that I could just manually control the visibility and enabled state as I switch around. However I can't find another way to make my windows appear other than setGUISheet.

I've already tried these tempting functions:

Code: Select all

   sheet->activate( );
   sheet->show( );



Fwiw, I'm using the layout editor to build my sheets. currently I just call:

Code: Select all

   CEGUI::WindowManager::getSingleton().loadWindowLayout( filename )

and then setGUISheet.

If someone could point me in the right direction, that would be great.

Thanks,
Duck

User avatar
Gaal
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Thu Jul 21, 2005 03:36
Location: Ô Toulouse

Postby Gaal » Sun May 21, 2006 20:24

In order to manage all my Dialog windows, here is what I'm doing :

First, I initialise a general "default window" with the following code :

Code: Select all

mGUI = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 0);
mGUISystem = new CEGUI::System(mGUI);
CEGUI::SchemeManager::getSingleton().loadScheme(schema);
mGUISystem->setDefaultMouseCursor(lookMouse, mouseCurseur);
mGUISystem->setDefaultFont(fontDefaut);
mRootGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultGUISheet", "root");
mGUISystem->setGUISheet(mRootGuiSheet);


When the Ogre sceneManager is known I call

Code: Select all

mGUI->setTargetSceneManager(mSceneMgr);


Then each time I need a dialog window (such as a messageBox, or inputBox like in VB) I do the following:

Code: Select all

mWinDialog = CEGUI::WindowManager::getSingleton().loadWindowLayout("MsgBox.xml", mIdent);
mGUISystem->addChildWindow(mWinDialog);
mWinDialog->addEvent(EventReponse);
mWinDialog->setModalState(true);

EventReponse being an event fired by the dialog

Then with a set of appropriate methodes such as:

Code: Select all

bool handleMsgBoxReponse(const CEGUI::EventArgs& e)
{
   const MsgEventArgs& msgArgs = static_cast<const MsgEventArgs&>(e);
   if (msgArgs.reponse == MSG_REP_OUI)
   {
      <process the answer Yes...>;
   } else {
      <process the answer No...>;
   }
   return true;
}

I can manage all my dialogs...

Hope it help

User avatar
Duck
Just popping in
Just popping in
Posts: 9
Joined: Sun Apr 30, 2006 17:15

Postby Duck » Mon May 22, 2006 02:24

Great,

Code: Select all

mGUISystem->addChildWindow(mWinDialog)


This was the bit I was missing.
So I now still use setGUISheet for changing the main page, but will just add/remove the temporary message boxes as child windows...

Thanks!

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon May 22, 2006 06:50

Hi,

good to hear you have a found a solution :-)

You might also be interested in this link:
http://www.cegui.org.uk/wiki/index.php/DialogSystem

Have fun.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests