Trying to LOAD multiple .LAYOUTS

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

Chewe
Just popping in
Just popping in
Posts: 14
Joined: Tue Jun 13, 2006 18:09

Postby Chewe » Thu Jun 22, 2006 21:57

Thx for the advise lindquist.

After rolling the stone, i get to this code that handles fine loading Listbox, mixing concepts from Demo6,preview posts, and ogre forum help.

Code: Select all

  ConfigOptionMap m_system_caps;
    
     m_system_caps = this->mRoot->getRenderSystem()->getConfigOptions();


      CEGUI::ListboxTextItem *list_box_item;
   
         Ogre::ConfigOptionMap::iterator itr = m_system_caps.begin();

         while(itr != m_system_caps.end())
         {
            if((itr)->first == "Video Mode")
            {
               Ogre::StringVector possible_values = (itr)->second.possibleValues;
               Ogre::StringVector::iterator pv_itr = possible_values.begin();
               while(pv_itr != possible_values.end())
               {
                  list_box_item = new CEGUI::ListboxTextItem((*pv_itr));
             
              static_cast<Combobox*>(WindowManager::getSingleton().getWindow("options/ResOptions"))->addItem(list_box_item);
             
              pv_itr ++;
               }
            }
            itr ++;
         }
   


Now i've managed to setconfig specific values, but i'm getting stuck again trying to get selection from combobox itemvalues on ApplyButton handle.

Code: Select all


bool handleOk(const CEGUI::EventArgs& e)
   {
         using namespace Ogre; // <-- ultimate in lazy
      
      
         RenderSystemList *rsList = mRoot->getAvailableRenderers();
         int c=0;
         bool foundit = false;
         RenderSystem *selectedRenderSystem=0;
         while(c < (int) rsList->size())
         {
            selectedRenderSystem = rsList->at(c);
            String rname = selectedRenderSystem->getName();
            if(rname.compare("Direct3D9 Rendering Subsystem")==0)
            {
               foundit=true;
               break;
            }
            c++; // <-- oh how clever
         }
               
         if(!foundit) return 0; //we didn't find it...
         
         selectedRenderSystem->setConfigOption("Video Mode", (list_box_item * CEGUI::Combobox::getSelectedItem("options/ResOptions"));
                  
         /* Help file
         ListboxItem * CEGUI::Combobox::getSelectedItem  (  void    )  const
         Return a pointer to the currently selected item. */

         //selectedRenderSystem->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour"); // That works

         mRoot->saveConfig();

         return true;
      }
 
};



How should i handle setconfig to store comboboxitem selected?

:oops:

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Sun Jun 25, 2006 14:10

I'm not sure if you found your solution but basically you can either query the text of the combobox with getText() or retrieve the id of the selected item. Look into the samples or within Widget Galore for samples.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 20 guests