Combo box not dropping

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
khariq
Just popping in
Just popping in
Posts: 9
Joined: Mon Mar 21, 2005 14:40

Combo box not dropping

Postby khariq » Sun May 01, 2005 17:43

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>

User avatar
daesdemon
Quite a regular
Quite a regular
Posts: 60
Joined: Fri Mar 11, 2005 21:19
Contact:

Re: Combo box not dropping

Postby daesdemon » Sun May 01, 2005 19:51

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.

User avatar
khariq
Just popping in
Just popping in
Posts: 9
Joined: Mon Mar 21, 2005 14:40

Re: Combo box not dropping

Postby khariq » Mon May 02, 2005 12:10

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;
}

User avatar
Gf11speed
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Mon Jun 13, 2005 17:51
Contact:

Re: Combo box not dropping

Postby Gf11speed » Mon Jun 13, 2005 17:55

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.

User avatar
khariq
Just popping in
Just popping in
Posts: 9
Joined: Mon Mar 21, 2005 14:40

Re: Combo box not dropping

Postby khariq » Mon Jun 27, 2005 03:22

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.

davewhit
Just popping in
Just popping in
Posts: 1
Joined: Wed Jun 07, 2006 14:12

Has anybody resolved this yet?

Postby davewhit » Thu Jun 08, 2006 23:56

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


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests