Popup menu passing data

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.
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Jul 17, 2017 2:30 pm

Popup menu passing data

Postby amuts » Mon Jul 17, 2017 2:42 pm

I have problem, that google ,nor wxwiki , nor documentation of wxwidgets could provide any guidelines.

I need to generate popup menu on mouse down event, that alows user to select one of multiple objects to interact with.
Thus far, i can create popup menu, and using connect(...) , make it respond. But, i have no way to determine witch of the objects was chosen.
In wxwiki there was an example using setClinetData, that sets pointer, but in this case i do not have actual object to pass the pointer to

any suggestions ?

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

Re: Popup menu passing data

Postby doublemax » Mon Jul 17, 2017 6:12 pm

The easiest way to solve this is to use wxWindow::GetPopupMenuSelectionFromUser() as it's a modal call which only return after the user selected an entry. So you don't need any event handler or carry information about the clicked item around.

http://docs.wxwidgets.org/trunk/classwx ... 682a61a93e
Use the source, Luke!

Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 6 guests