Page 1 of 1

EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Posted: Tue Mar 10, 2015 11:23 am
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.

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Posted: Tue Mar 10, 2015 11:41 am
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?

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Posted: Tue Mar 10, 2015 12:28 pm
by nandakishore
i want to catch EVT_DATAVIEW_ITEM_CONTEXT_MENU event which is part of wxDataViewCtrl for multiple times

Re: EVT_COMMAND_RANGE for wxDataViewCtrl Events?

Posted: Tue Mar 10, 2015 12:35 pm
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
}