Combobox - can you get the selected string from the event? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Combobox - can you get the selected string from the event?

Post by JohnD » Wed Jan 26, 2011 10:21 am

A wxCommandEvent will tell me the selected index when I catch wxEVT_COMMAND_COMBOBOX_SELECTED events, but to get the string I need the control itself. Do I have to store a class member for the control or is there a way to do this from the event object only?

Part Of The Furniture
Part Of The Furniture
Posts: 2662
Joined: Sun Jan 03, 2010 5:45 pm

Post by PB » Wed Jan 26, 2011 10:30 am

Event.GetString() doesn't work for you? It should be as simple as that, at least according to MyPanel::OnCombo() in the Controls example.
Even if this for some reason doesn't work, you should be able to get the combobox using the event id or object without the need of declaring a class member for it.

User avatar
Posts: 15267
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Wed Jan 26, 2011 11:20 am
This should work for other classes, too.
Use the source, Luke!

Post Reply