MyGUI FAQ        
Print

Q: Something works wrong. Why?

 

A: Check MyGUI.log.

 

Q: Why MyGUI can't find textures?

Q: Why when creating any widget I have exception "layer '[any_layer_name]' not found"?

A:

  1. Check that MyGUI_Media folder in resources.cfg
  2. Check that MyGUI_Media folder in default resource group General
    • For loading MyGUI from another resource group write this
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow, mSceneManager, "MyResourceGroupName");

 

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.

mGUI->injectFrameEntered(evt.timeSinceLastFrame);
Info Note: This method was removed in MyGUI 3.0 and it is called inside renderer automatically.

 

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.

(MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setSceneManager(newSceneManager);

 

Q: What function do I have to call so my CheckBox actually stays checked after it was clicked?

 
A: Add eventMouseButtonclick:

button->eventMouseButton<x>click = MyGUI::newDelegate(this, &[class_name]::notifyToggleCheck);
 
void [class_name]::notifyToggleCheck(MyGUI::WidgetPtr _sender)
{
    MyGUI::ButtonPtr checkbox = _sender->castType<MyGUI::Button>();
    checkbox->setStateSelected(!checkbox->getStateSelected());
}
Or just add this two lines to your on click event if you already have it.

 

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 can create it after and then call (with only those parts that wasn't ready an initialisation stage, so if you created Ogre::RenderSystem and Ogre::RenderWindow before you need only set viewport)

(MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setSceneManager(mSceneManaer);
 (MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setRenderWindow(mWindow);
 (MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setActiveViewport(index);

 

Q: My code compiles and runs as in the previous question. My scene displays, but I don't see the GUI

 
A (1): If you are using multiple viewports, you need to tell the platform render manager about this:

(MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setActiveViewport(1);

The parameter is the index of the viewport in the Ogre render window, and is equal to the return value of Ogre::RenderWindow::getNumViewports() 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.

A (2): Make sure you're initializing MyGUI after you've initialised it's corresponding resource group in Ogre's ResourceManager. Otherwise, the gui will not show up even though MyGUI.log will report that all it's .xml files were found and parsed fine.

Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
 
// code code code ...
 
MyGUI::OgrePlatform* mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(ogreRenderWindow, ogreSceneManager);
mGUI = new MyGUI::Gui();
mGUI->initialise();

 
A (3): Make sure overlays are enabled on your viewport. MyGUI only renders to viewports with overlays enabled.

viewport->setOverlaysEnabled(true);

 


Contributors to this page: scrawl795 points  , Tp56 points  , Mind Calamity1128 points  , jacmoe180265 points  , An00biS438 points  and Altren791 points  .
Page last modified on Saturday 31 of August, 2013 16:25:31 UTC by scrawl795 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.