Page 1 of 1

ListBox using problem

Posted: Sat Dec 08, 2007 2:51 pm
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)

Posted: Sun Dec 09, 2007 4:58 pm
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;
            }