Page 1 of 1

Combo box not dropping

Posted: Sun May 01, 2005 17:43
by khariq
When I display a combo box which I have loaded with strings (code below) the combo box doesn't "drop". I used the Ogre GUI demo as the basis for this. Has anyone ever run into this problem before?

Code: Select all

   CEGUI::Combobox* win = (CEGUI::Combobox*)CEGUI::WindowManager::getSingleton().getWindow("FleetDesigner/FleetDropDown");
   std::list<std::string> fleets = GameManager::GetSingleton().GetAvailableFleets();
   std::list<std::string>::iterator itr = fleets.begin();
   int i = 1;
   for (; itr != fleets.end(); itr++)
   {
      win->addItem(new CEGUI::ListboxTextItem((CEGUI::utf8*)(*itr).c_str(), i++));
      GameManager::GetSingleton().GetLog()->WriteMessage("Name added to drop down: " + (*itr));
   }

   win->addItem(new CEGUI::ListboxTextItem((CEGUI::utf8*)"Testing", 0));



XML Layout code

Code: Select all

<Window Type="TaharezLook/Combobox" Name="FleetDesigner/FleetDropDown">
         <Property Name="AbsoluteRect" Value="l:512.000000 t:14.000000 r:640.000000 b:38.000000" />
         <Property Name="RelativeRect" Value="l:0.800000 t:0.030000 r:1.000000 b:0.080000" />
         <Property Name="ClippedByParent" Value="false" />
               <Property Name="ReadOnly" Value="true" />
         </Window>

Re: Combo box not dropping

Posted: Sun May 01, 2005 19:51
by daesdemon
Hello,
The size of the combobox, is in fact the size of the dropdownList so i guess that your size is a little too small, perhaps.

Re: Combo box not dropping

Posted: Mon May 02, 2005 12:10
by khariq
I found the problem. I forgot to tell Ogre to pass the clicked event for this widget to CEGUI. However now I get a new problem. Does a combobox not support the EventMouseEnters and EventMouseLeaves events? Because these subscriptions are not firing.

Code: Select all

mEventSubscriptions.push_back(
      wMgr.getWindow("TestCombo")->subscribeEvent(
         CEGUI::Window::EventMouseEnters,
         CEGUI::Event::Subscriber(&MainMenuHandler::MouseOver, this)
         )
      );
   mEventSubscriptions.push_back(
      wMgr.getWindow("TestCombo")->subscribeEvent(
         CEGUI::Window::EventMouseLeaves,
         CEGUI::Event::Subscriber(&MainMenuHandler::MouseOff, this)
         )
      );

...

bool MainMenuHandler::MouseOff(const CEGUI::EventArgs& e)
{
   if (InputListener::GetSingletonPtr())
      InputListener::GetSingletonPtr()->MouseOverGUI(false);
   GameManager::GetSingleton().GetLog()->WriteMessage("Mouse moved off GUI");
   return true;
}

bool MainMenuHandler::MouseOver(const CEGUI::EventArgs& e)
{
   if (InputListener::GetSingletonPtr())
      InputListener::GetSingletonPtr()->MouseOverGUI(true);
   GameManager::GetSingleton().GetLog()->WriteMessage("Mouse moved over GUI");
   return true;
}

Re: Combo box not dropping

Posted: Mon Jun 13, 2005 17:55
by Gf11speed
khariq wrote:
I found the problem. I forgot to tell Ogre to pass the clicked event for this widget to CEGUI. However now I get a new problem. Does a combobox not support the EventMouseEnters and EventMouseLeaves events? Because these subscriptions are not firing.


Could you post the code on how you fixed the drop down problem? My comboboxes aren't dropping down either. Thanks.

Re: Combo box not dropping

Posted: Mon Jun 27, 2005 03:22
by khariq
Hope this helps

Code: Select all


void SkirmishMenuHandler::SetupHandlers()
{
   //load the available databases
   /*
   CEGUI::Combobox* win = (CEGUI::Combobox*)CEGUI::WindowManager::getSingleton().getWindow("FleetDesigner/FleetDropDown");
   std::list<std::string> fleets = BlueEngine::GameManager::GetSingleton().GetAvailableFleets();
   std::list<std::string>::iterator itr = fleets.begin();
   int i = 1;
   for (; itr != fleets.end(); itr++)
   {
      win->addItem(new CEGUI::ListboxTextItem((CEGUI::utf8*)(*itr).c_str(), i++));
      BlueEngine::GameManager::GetSingleton().GetLog()->WriteMessage("Name added to drop down: " + (*itr));
   }

   win->addItem(new CEGUI::ListboxTextItem((CEGUI::utf8*)"Testing", 0));
   */

   /*
   CEGUI::Listbox* lb = (CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().getWindow("FleetDesigner/AvailableShips");
   std::list<std::string> chaos = GameManager::GetSingleton().GetChaosFleetList();
   itr = chaos.begin();
   for(; itr != chaos.end(); itr++)
      lb->addItem(new CEGUI::ListboxTextItem((*itr)));
   */
   //setup any subscriptions
   /*
   CEGUI::WindowManager& wMgr = CEGUI::WindowManager::getSingleton();
   mEventSubscriptions.clear();
   mEventSubscriptions.push_back(
      wMgr.getWindow("FleetDesigner/FleetDropDown")->subscribeEvent(
      CEGUI::Combobox::EventMouseClick,
         CEGUI::Event::Subscriber(&SkirmishMenuHandler::OnFleetDropDown, this)
         )
      );
   mEventSubscriptions.push_back(
      wMgr.getWindow("FleetDesigner/FleetDropDown")->subscribeEvent(
      CEGUI::Combobox::EventMouseButtonDown,
         CEGUI::Event::Subscriber(&SkirmishMenuHandler::OnFleetDropDown, this)
         )
      );
      */
}

bool SkirmishMenuHandler::OnFleetDropDown(const CEGUI::EventArgs& e)
{
   CEGUI::ComboDropList* list = (CEGUI::ComboDropList*)CEGUI::WindowManager::getSingleton().getWindow("FleetDesigner/FleetDropDown/DropDownList");
   
   list->show();
   
   return true;
}


if not post what you've got and I'll take a look.

Has anybody resolved this yet?

Posted: Thu Jun 08, 2006 23:56
by davewhit
I've encountered the same problem whereas my Scrollbar will not fire off for the EventMouseEnters Event it is subscribed to.

Has anybody figured out how to fix this?

thanks,
dave