Page 1 of 1

Combobox Craziness

Posted: Fri Jul 01, 2005 03:58
by EJohnson
I'm having some issues with displaying a Combobox and have run out of ideas.

I create the Combobox and ListboxTextItems as shown below:

Code: Select all

CEGUI::Combobox *b = (CEGUI::Combobox*)wm->createWindow("WindowsLook/Combobox", "Listbox");
b->setPosition( CEGUI::Point(0.01f, 0.7f));
b->setSize( CEGUI::Size(0.4f, 0.2f ));
b->setReadOnly(true);

CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( (CEGUI::utf8*)"hello1");
b->addItem(item);

CEGUI::ListboxTextItem *item2 = new CEGUI::ListboxTextItem( (CEGUI::utf8*)"hello2");
b->addItem(item2);


When run, the Combobox get's displayed, but no items are rendered. If I "click" in the pulldown list, my selected item now magically gets rendered in the collapsed Combobox.

It seems the items never get rendered in the pulldown list. Any ideas?

0.3.0 release/OpenGLRenderer/WindowsLook Widgets

Thanks!

Re: Combobox Craziness

Posted: Fri Jul 01, 2005 09:19
by CrazyEddie
You have to set the colour for the text items. It deafults to white, so in WindowsLook you can't see it :lol:

You might consider a ListboxTextItem sub-class which does this for you, as it saves doing it yourself every time. Also, if you want the selection highlight to work you need to set a selection brush and colour for each item too (this can also be done in your sub-class).

HTH

CE.

Re: Combobox Craziness

Posted: Tue Jul 05, 2005 22:42
by EJohnson
Yup, changing the ListboxTextItem colour did the trick!

One more related question:
How do I get the Combobox to display a default ListboxTextItem?

Thanks!

Re: Combobox Craziness

Posted: Wed Jul 06, 2005 08:16
by CrazyEddie
You mean in the editbox portion?

Just set the text to be the same as one of the combobox items.

Re: Combobox Craziness

Posted: Wed Jul 06, 2005 16:48
by EJohnson
Perfect. All it well now!

Thanks,
Erik