Listbox event question

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
khamill
Posts: 17
Joined: Thu Mar 08, 2007 3:50 pm
Location: Nova Scotia, Canada

Listbox event question

Post by khamill »

Hi Guys,

I have a listbox event coming in. I'm getting separate events for separate listboxes. All is good.

Question:

How do I tell which item in the listbox has been selected? For example, If I have a listbox with "Yes" and "No" items and I select "Yes" to get the event, How do I know this event is for the "Yes" selection. Is there a field in the event coming in with an item # or text value?

I've checked the docs and it doesn't appear obvious unless I'm not seeing it which is entirely possible (likely).

thanks

Kevin
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The event.GUIEvent.Caller can be a pointer to the IGUIElement that generated the message. You can use use getID() to get the ID of the element. If necessary, you can cast the Caller to the appropriate element type so you can call functions on it. If event.GUIEvent.EventType is gui::EGET_LISTBOX_CHANGED you should be able to cast the Caller pointer to an IGUIListBox.

Travis
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

right, and with getSelected() you can check witch listbox item is selected...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
khamill
Posts: 17
Joined: Thu Mar 08, 2007 3:50 pm
Location: Nova Scotia, Canada

Post by khamill »

Thanks

getSelected() did the trick!!

Kevin
Post Reply