Page 1 of 1

adding to Combobox does nothing (Listbox works however)

Posted: Sun May 01, 2011 06:54
by blablub
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"));

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

Posted: Mon May 02, 2011 15:18
by Jamarr
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);