History: MyGUI FAQ
Source of version: 4
Copy to clipboard
{DIV(class="Layout_box2")}__Q:__ Why when creating any widget I have exception "layer '[any_layer_name]' not found"?
__A:__
# Check that MyGUI_Media folder in ''resources.cfg''
# Check that MyGUI_Media folder in default resource group __General__
**For loading MyGUI from another resource group write this
{CODE(wrap="1", colors="c++")}mGUI->initialise(your_window, "core.xml", '''your_resource_group''');{CODE}{DIV}
{DIV(class="Layout_box5")}__Q:__ Why Combobox popup/Tab widget sheets selecting/RenderBox autorotate/Progress bar autotrack/Edit caret blinking/Message doesn't work?
__A:__ All of this happens when you don't call inject every frame.
{CODE(wrap="1", colors="c++")}mGUI->injectFrameEntered(evt.timeSinceLastFrame);{CODE}{DIV}
{DIV(class="Layout_box2")}__Q:__ Why do the GUI disappears when I change the camera?
__A:__ If a new camera have a new Scene Manager, you need set the GUI on a new Scene Manager.
{CODE(wrap="1", colors="c++")}mGUI->setSceneManager(mCamera->getSceneManager());{CODE}{DIV}
{DIV(class="Layout_box5")}__Q:__ What function do I have to call so my checkBox actually stays checked after it was clicked?
__A:__ Add eventMouseButtonClick:
{CODE(wrap="1", colors="c++")}button->eventMouseButtonClick = MyGUI::newDelegate(this, &[class_name]::notifyToggleCheck);
void [class_name]::notifyToggleCheck(MyGUI::WidgetPtr _sender)
{
MyGUI::ButtonPtr checkbox = _sender->castType<MyGUI::Button>();
checkbox->setStateCheck(!checkbox->getStateCheck());
}{CODE}
Or just add this two lines to your on click event if you already have it.{DIV}
{DIV(class="Layout_box2")}__Q:__ My code compiles and runs. The logs do not report any problems, but all I see is a blank screen.
__A:__ Make sure you either create the scene manager, camera, and viewport before you initialize the ogre platform class, or you set the viewport.{DIV}
{DIV(class="Layout_box5")}__Q:__ My code compiles and runs as in the previous question. My scene displays, but I don't see the GUI
__A:__ If you are using multiple viewports, you need to tell the platform render manager about this:
{CODE(wrap="1", colors="c++")}(MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setActiveViewport(1);{CODE}
The parameter is the index of the viewport in the Ogre render window, and is equal to the return value of {MONO()}Ogre::RenderWindow::getNumViewports(){MONO} just ''before'' the viewport used for MyGUI is generated. If you generate viewports dynamically, make sure you repeat this with a decremented index after you remove a viewport that was created before the MyGUI viewport.{DIV}