adding to Combobox does nothing (Listbox works however)

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

blablub
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Tue Mar 01, 2011 11:56

adding to Combobox does nothing (Listbox works however)

Postby blablub » Sun May 01, 2011 06:54

Hi, I have a strange problem with CEGUI 0.7.5. I have a Combobox and want to add a ListboxTextItem to it. I use the code posted below. Adding to the combobox gives no error or warning, it simply does nothing (the box stays empty).
The exaxt same code, only replaced by a Listbox works perfectly.

Code: Select all

//This works, "MyListbox" is existing and of type CEGUI::Listbox (read from .layout file)
static_cast<CEGUI::Listbox*>(wmgr->getWindow("MyListbox"))->addItem(new CEGUI::ListboxTextItem("Test1"));

//This doesn't work, "MyCombobox" is existing and of type CEGUI::Combobox (read from .layout file)
static_cast<CEGUI::Combobox*>(wmgr->getWindow("MyCombobox"))->addItem(new CEGUI::ListboxTextItem("Test2"));

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: adding to Combobox does nothing (Listbox works however)

Postby Jamarr » Mon May 02, 2011 15:18

It would be hard to diagnose this issue with the (lack) of information given, but this smells like one of CEGUIs older recurring issues. I am assuming that the items are actually being added, you just cannot see them because the text-colour matches the background-colour. Try something like this (tweak for your needs):

Code: Select all

   CEGUI::ListboxTextItem* listboxItem = new CEGUI::ListboxTextItem("Test2");
   listboxItem->setTextColours(CEGUI::colour(0,0,0,1));
   listboxItem->setSelectionBrushImage("WindowsLook", "Background");
   listboxItem->setSelectionColours(CEGUI::colour(.12f,.12f,1,1));

   static_cast<CEGUI::Combobox*>(wmgr->getWindow("MyCombobox"))->addItem(listboxItem);
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 21 guests