Combobox Craziness

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
EJohnson
Just popping in
Just popping in
Posts: 11
Joined: Fri Jul 01, 2005 03:45
Location: California
Contact:

Combobox Craziness

Postby EJohnson » Fri Jul 01, 2005 03:58

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!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Combobox Craziness

Postby CrazyEddie » Fri Jul 01, 2005 09:19

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.

User avatar
EJohnson
Just popping in
Just popping in
Posts: 11
Joined: Fri Jul 01, 2005 03:45
Location: California
Contact:

Re: Combobox Craziness

Postby EJohnson » Tue Jul 05, 2005 22:42

Yup, changing the ListboxTextItem colour did the trick!

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

Thanks!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Combobox Craziness

Postby CrazyEddie » Wed Jul 06, 2005 08:16

You mean in the editbox portion?

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

User avatar
EJohnson
Just popping in
Just popping in
Posts: 11
Joined: Fri Jul 01, 2005 03:45
Location: California
Contact:

Re: Combobox Craziness

Postby EJohnson » Wed Jul 06, 2005 16:48

Perfect. All it well now!

Thanks,
Erik


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 9 guests