Using Listboxes

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
zander1976
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 08, 2005 13:32
Contact:

Using Listboxes

Postby zander1976 » Thu May 19, 2005 11:57

Hello Everybody,

I did some searching threw the forum and I can't really find anything that is helping me. I have also looked threw the api ref and I am not sure what the best way to use listboxes.

I am creating the listbox item with and id:

Code: Select all

CEGUI::ListboxTextItem *listboxitem = new CEGUI::ListboxTextItem( text, id );

List->addItem(listboxitem);


That works great, now what I am having problems with is deleting the item. Is there anyway to delete based on the id. Something like:

Code: Select all

List->deleteItem( id );


Also do I have to delete the item myself

Code: Select all

CEGUI::ListboxTextItem *item = List->getItem( id );
delete item;
item = ;
List->deleteItem( id );


Ohh, one last question when I select an item can i get it to return the key I gave it or just the text.

Thanks, Ben

User avatar
zander1976
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 08, 2005 13:32
Contact:

Re: Using Listboxes

Postby zander1976 » Thu May 19, 2005 15:07

Hello,

I figured it out (well sort of anyway). Here is what I ended up doing. Its deleting based on text now.

Code: Select all

CEGUI::ListboxItem *listboxitem = mPlayerList->findItemWithText( name, mPlayerList->getListboxItemFromIndex(0) );
mPlayerList->removeItem( listboxitem );


Let me know if this is a bad idea

Ben


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 6 guests