How to change GUI skin dynamically

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

iversion
Just popping in
Just popping in
Posts: 18
Joined: Sat Jun 24, 2006 05:03

How to change GUI skin dynamically

Postby iversion » Wed Jul 19, 2006 09:54

I have two xxxlookskin.scheme files. And I let users select which skin for the GUI. I try to use the CEGUI::SkinManager's member methods. But I got a exception.
How to achieve that ? Should I just restart the program to reload the new skin files? But I don't know how to restart it.
Can anybody give me an answer or a better solution?
Thank you! :)

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Wed Jul 19, 2006 09:56

Please post details of the exception (what is the message? Where in the code does it occur?).

iversion
Just popping in
Just popping in
Posts: 18
Joined: Sat Jun 24, 2006 05:03

Postby iversion » Wed Jul 19, 2006 11:33

I create a list to let user to choose different skins.
And in the class TestApplication which inherit the ExampleApplication , I use handleSkinSelection to handle the selection of user.

Code: Select all

   bool handleSkinSelection(const CEGUI::EventArgs& e)
    {
        const CEGUI::WindowEventArgs& windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>(e);
        CEGUI::ListboxItem* item = static_cast<CEGUI::Combobox*>(windowEventArgs.window)->getSelectedItem();
      int skinId=item->getID();

            switch(skinId)
      {
      case 0:
         if(!CEGUI::SchemeManager::getSingleton().isSchemePresent((CEGUI::utf8*)"TaharezLookSkin.scheme"))
         {
            CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); 
         }
         break;
      case 1:
         
         if(!CEGUI::SchemeManager::getSingleton().isSchemePresent((CEGUI::utf8*)"NewLookSkin.scheme"))
         {
            CEGUI::SchemeManager::getSingleton().getScheme((CEGUI::utf8*)"NewLookSkin.scheme"); 
         }
         break;
      default:
         break;
      }

        return true;
    }
 


When I select the TaharezLook in the listbox, then there goes the exception:

Microsoft C++ exception: CEGUI::UknownObjectException

Does my way go wrong? If it does, could you give a solution?


Return to “Help”

Who is online

Users browsing this forum: No registered users and 12 guests