[SOLVED] Combobox selection change

shanefarris

15-02-2011 22:32:16

I can't find an event for the combobox that will fire off when something is selected in it. This would fire off when the user selects something in the combobox and nothing else. Does that event exist?

Thanks.

Altren

15-02-2011 23:09:21

/** Event : Enter pressed in combo mode or item selected in drop down list.\n
signature : void method(MyGUI::ComboBox* _sender, size_t _index)
@param _sender widget that called this event
@param _index item
*/
EventPair<EventHandle_WidgetVoid, EventHandle_ComboBoxPtrSizeT>
eventComboAccept;

shanefarris

15-02-2011 23:23:16

I'll have to recreate the code, but I wasn't able to get that event to fire, and it sounded like it only fired if you press enter, that's not the case?

shanefarris

15-02-2011 23:37:49

Here is my code, and that event is not firing


cmbPhysicsTypes->eventComboAccept = MyGUI::newDelegate(this, &CPropertiesMenu::notifyComboAccept);



void CPropertiesMenu::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
{
int i = 0;
}

Altren

16-02-2011 08:07:43

My bad, here's event that you actually need.
/** Event : Position changed.\n
signature : void method(MyGUI::ComboBox* _sender, size_t _index)
@param _sender widget that called this event
@param _index of new position
*/
EventPair<EventHandle_WidgetSizeT, EventHandle_ComboBoxPtrSizeT>
eventComboChangePosition;

Altren

16-02-2011 08:10:08

eventComboAccept fired on enter, or on click if you set combobox->setComboModeDrop(true); first.

shanefarris

16-02-2011 15:20:53

It's not firing, here is what I have:


cmbPhysicsTypes->eventComboChangePosition = MyGUI::newDelegate(this, &CPropertiesMenu::notifyComboAccept);



void CPropertiesMenu::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
{
int i = 0;
}


I put a break point in the event method, and nothing. I also tried setting setComboModeDrop(true) and using the eventComboAccept event, and still nothing. Any ideas?

Thanks.

samaursa

23-02-2011 01:09:59

That should work, I have the exact same code for a couple of combo-boxes in my interface and they work with the exact code that you posted. Are you absolutely sure that cmbPhysicsTypes is pointing to the correct combo-box?

shanefarris

23-02-2011 22:41:23

Maybe I am missing something with updating. Buttons work fine, but I am also trying to use the eventScrollChangePosition event for a scroll bar I have and that isn't firing either.

sldPitch->eventScrollChangePosition = MyGUI::newDelegate(this, &CObjectsMenu::sldPitch_Click);


void CObjectsMenu::sldPitch_Click(MyGUI::VScroll* _sender, size_t _position)
{
isPitch = true;
}


I put a break point in that method, and nothing. Any ideas what could cause this?

shanefarris

24-02-2011 19:10:25

The MyGui version I was using was about a year old. I just compiled the newest version and the slider event now works. I'm guessing the combo box event will work now too, I'll try here shortly.

shanefarris

24-02-2011 19:15:40

Yes the combo box works like a charm too. 3.0.2 was the solution.

samaursa

24-02-2011 19:30:54

Good to know! But I wonder why it compiled but did not do anything before? Or maybe MyGui.log had a bunch of errors relating to this issue.

shanefarris

25-02-2011 17:17:14

No I checked the log, and nothing. I'm just happy it works now :)

MyGui rocks!