ListBox using problem

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
sanctus2099
Posts: 18
Joined: Sat Nov 17, 2007 11:34 am

ListBox using problem

Post by sanctus2099 »

So... I have a list box.. I know how to add items to it but I don't know how to implement it in the EventReceiver.
I did something like:
case EGET_LISTBOX_CHANGED:
and checked if there is the correct id... but nothing happends.
Morehover I tryed to debug it... and when I press a button it gets in the case... if I select something form the listbox it doesn't.
Could someone write a very simple example (just the code to be pun in the EvenReceiver).
Also I'd like to get the number of the item that was selected(as in 0 to number of items-1)
fireside
Posts: 158
Joined: Thu Dec 01, 2005 10:55 pm

Post by fireside »

This is what I do, but I am kind of a noob here:

Code: Select all

             if (event.EventType == EET_GUI_EVENT)
		      {
			   s32 id = event.GUIEvent.Caller->getID();
  			   if (event.GUIEvent.EventType  ==EGET_LISTBOX_CHANGED)
                {
                  listChanged = true;
                }
Public:

Code: Select all

    bool getListChanged(){if(listChanged){listChanged = false;return true;}else return false;}
game loop:

Code: Select all

            if(rv.getListChanged())
            {
            signed int n = list->getSelected();
            switch(n)
            {
            case -1:str = "";break;
            case 0: str = "";break;
            case 1: str = "";break;
            }
Post Reply