Problem when i try create a second window

netocris

01-08-2007 14:59:07

I'm new in QuickGUI, and i'm experiment and i liked. but i'm with some problems.

i try make one application whit a simple menu. this principal menu have the follow bottons: singleplayer, multiplayer, option menu and exit.
the option menu botton will open a second window with options that permit switch option of video, sound, ...
My problem occours when i try create one 3rd window. when i lunch the application appears the next exception:

OGRE EXCEPTION(4:ItemIdentityException): OverlayElement with name DefaultWindow0.ChildrenContainer alreadu exists. in OverlayManager::createOverlayElement at
d:\ogrenew\ogremain\src\pgrepverlaymanager.cpp (line 548)

my code is:
void EstadoMenu::iniciar()
{
//ficheiro de log
log = Ogre::LogManager::getSingleton().createLog("estadoMenu.log");

(...)

mRoot = Ogre::Root::getSingletonPtr();
mSceneMgr = mRoot->createSceneManager( Ogre::ST_GENERIC );
mCamera = mSceneMgr->createCamera( "MenuCamera" );
mViewport = mRoot->getAutoCreatedWindow()->addViewport( mCamera );

...

//Create video option (option like video mode, resolution,...)
this->criarMenuVideo();
//create option menu (option like video, sound, commands, ...)
this->criarMenuOpcoes();
//create the principal menu (Button singleplayer, multiplayer, option menu and exit )
this->criarMenu();

//initializate sound
}

if i cancel the creation of this 3rd window this exception not occours.

//Create video option (option like video mode, resolution,...)
//this->criarMenuVideo();
//create option menu (option like video, sound, commands, ...)
this->criarMenuOpcoes();
//create the principal menu (Button singleplayer, multiplayer, option menu and exit )
this->criarMenu();



my create video function is:
void EstadoMenu::criarMenuVideo( void )
{

log->logMessage("**** CRIAR MENU VIDEO ****");

//-------------
// Definir Skin
//-------------
log->logMessage("*** A criar Sheet: lostSheet_video ...");
//mSheet_options = GUIManager::getSingletonPtr()->createSheet("lostSheet_options", "qgui.background");
this->mSheet_video = GUIManager::getSingletonPtr()->createSheet("lostSheet_video", "qgui.background");
GUIManager::getSingletonPtr()->setActiveSheet(this->mSheet_video);
log->logMessage("*** Concluido!");


//-----------------------
// Criar janela "Video"
//-----------------------

log->logMessage("*** A criar janela: Video Options ...");
this->videoJanela = this->mSheet_video->createWindow(Ogre::Vector4(0.2,0.2,0.6,0.6));
this->videoJanela->setTitleBarHeight(0.05);
this->videoJanela->hideTitlebar();
log->logMessage("*** Concluido!");


//----------------------------------
// Criar botao Voltar Menu Options
//----------------------------------
log->logMessage("*** A criar botao: Back ...");
this->voltarMenuOptions = this->videoJanela->createButton(Ogre::Vector4(0.55, 0.9, 0.2, 0.06));
this->voltarMenuOptions->setText("Back");
this->voltarMenuOptions->addEventHandler(Widget::QGUI_EVENT_MOUSE_BUTTON_UP, &EstadoMenu::evtHndlr_BackToOptionsMenu, this);
log->logMessage("*** Concluido!");
log->logMessage("**** FIM DE CRIAR MENU VIDEO ******");

}


my create Option menu funtion is:
void EstadoMenu::criarMenuOpcoes(void)
{

log->logMessage("**** CRIAR MENU OPTIONS ***");

//-------------
// Definir Skin
//-------------
log->logMessage("*** A criar Sheet: lostSheet_options ...");
this->mSheet_options = GUIManager::getSingletonPtr()->createSheet("lostSheet_options", "qgui.background");
GUIManager::getSingletonPtr()->setActiveSheet(this->mSheet_options);
log->logMessage("*** Concluido!");

//-----------------------
// Criar janela "Options"
//-----------------------
log->logMessage("*** A criar janela: Options ...");
this->opcoesJanela = this->mSheet_options->createWindow(Ogre::Vector4(0.2,0.2,0.6,0.6));
//this->opcoesJanela->setText("Options");
this->opcoesJanela->setTitleBarHeight(0.05);
this->opcoesJanela->hideTitlebar();
log->logMessage("*** Concluido!");


//$$$$$$ VIDEO OPTION $$$$$$$

..

//$$$$$$ VIDEO OPTION $$$$$$$



//$$$$$ SOUND OPTION $$$$$$$$

...

//$$$$$ SOUND OPTION $$$$$$$$


//------------------------------
// Criar botao VideoOptionAdvanced
//------------------------------
log->logMessage("*** A criar botao: VideoOptionAdvanced...");
this->salvarOpcoesButton = this->opcoesJanela->createButton(Ogre::Vector4(0.25, 0.90, 0.2, 0.06));
this->salvarOpcoesButton->setText("VideoOptionAdvanced");
this->salvarOpcoesButton->addEventHandler(Widget::QGUI_EVENT_MOUSE_BUTTON_UP, &EstadoMenu::evtHndlr_VideoOptionsMenu, this);
log->logMessage("*** Concluido!");

(...)

log->logMessage("******************* FIM DE CRIAR MENU OPTIONS ***********************");
}

what it´s badly with my code????

kungfoomasta

01-08-2007 19:23:38

It looks like a window is being created and its OverlayContainer is using the same name as an already existing OverlayContainer. When you debug, what line does it break at?

Also, I'm busy working on the next version, which won't be using OverlayContainers, elements, or regular Overlays. I have seen people raise similar issues before, maybe I am not cleaning up the OverlayContainer properly.

netocris

01-08-2007 22:49:46

the portion of code that causes the exception is when i create the window object. if i comment this part nothing ocours. the Sheet* object is created without any problems, but when the application try create the Window* object it crash.

It's this line how crash the application and launch the exception

this->videoJanela = this->mSheet_video->createWindow(Ogre::Vector4(0.2,0.2,0.6,0.6));

1st is created the window* how controls the window option, and when i try create the mSheet_video window launch the exception.

another thing: when i try to load the new window i must hide the 1st window before active the new and show the new window? it's it?