EVT_COMMAND_RANGE for wxDataViewCtrl Events? 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
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Post by nandakishore »

Hi,

I'm Creating multiple wxDataViewCtrl in the runtime. How to handle events for them?.
I'm unable to use EVT_COMMAND_RANGE for handling multiple wxDataViewCtrl event.
Got a Problem???..No worry..Focus on Solution not on Problem :P
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Post by doublemax »

EVT_COMMAND_RANGE is used for something else, e.g. if you want to catch a button click event for a range of IDs like 1000-2000.

What exactly is your problem?
Use the source, Luke!
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Post by nandakishore »

i want to catch EVT_DATAVIEW_ITEM_CONTEXT_MENU event which is part of wxDataViewCtrl for multiple times
Got a Problem???..No worry..Focus on Solution not on Problem :P
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Post by doublemax »

If you use wxID_ANY as id in the event table macro, it's valid for all wxDataViewCtrl instances.

Inside the event handler you can get a pointer to the correct instance using wxEvent::GetEventObject().

Code: Select all

wxDataViewCtrl *my_control = wxDynamicCast( evt.GetEventObject(), wxDataViewCtrl )
if( my_control != NULL )
{
  // your code here
}
Use the source, Luke!
Post Reply