razali2k5
23-05-2010 19:49:50
For some reason the code that I normally use to unload a layout does not work in one instance. So this is how I initialize and setup the GUI for the console:
and when I want to unload the layout I use this code
I have to manually make it invisible. It is also inconvenient because when I rerun the first part of the code I pasted here, it keeps all of the information from the old console (which surely means it is not unloading it). What could be wrong?
Thanks!
MyGUI::OgreRenderManager::getInstance().setSceneManager(mSceneMgr);
mGUI = MyGUI::Gui::getInstancePtr();
mGUI->setVisiblePointer(false);
mConsoleLayout = MyGUI::LayoutManager::getInstance().load("Console.layout");
mConsoleWindow = mGUI->findWidget<MyGUI::Window>("ConsoleWindow");
mConsoleWindow->eventWindowButtonPressed = newDelegate(this, &PlayState::notifyWindowButtonPressed);
mListHistory = mGUI->findWidget<MyGUI::Edit>("ConsoleWindow_HistoryList");
mComboCommand = mGUI->findWidget<MyGUI::ComboBox>("ConsoleWindow_CommandCombo");
mButtonSubmit = mGUI->findWidget<MyGUI::Button>("ConsoleWindow_SubmitButton");
and when I want to unload the layout I use this code
mConsoleWindow->setVisibleSmooth(false); // Hack because the layout is not getting unloaded correctly
MyGUI::LayoutManager::getInstancePtr()->unloadLayout(mConsoleLayout);
mConsoleLayout.clear();
I have to manually make it invisible. It is also inconvenient because when I rerun the first part of the code I pasted here, it keeps all of the information from the old console (which surely means it is not unloading it). What could be wrong?
Thanks!