Is there any way make few wxDataViewItem (row) selectable and few non-selectable. I am using generic wxDataViewCtrl.
I found wxEVT_DATAVIEW_SELECTION_CHANGED triggers after selection change is done. There is no EVT_DATAVIEW_SELECTION_CHANGING event, there I can stop this event.
Make generic wxDataViewCtrl rows non-selectable
Re: Make generic wxDataViewCtrl rows non-selectable
I would try to catch the wxEVT_LEFT_DOWN event, do a HitTest() to find the item under the mouse and either consume the event (by doing nothing) or let it pass through (by calling event.Skip().
Unfortunately this can have some bad side-effects, but first check if it works at all.
Unfortunately this can have some bad side-effects, but first check if it works at all.
Use the source, Luke!
Re: Make generic wxDataViewCtrl rows non-selectable
Yeah, you are right. I tried the approach given by you. It is working but at the same time, it is opening another set of issues in expand/collapse button functionality.
Now, I am capturing the selection change event and if selected item is not of my interest, I am de-selecting it back.
I know it is not a good way, but I have no other way.
It will be good if we can have "Selection Begin" kind of event that can be vetoed. Or virtual Select() method, that I can override and change the behavior. Or a simple API to make the wxDataViewItem non-selectable.
Now, I am capturing the selection change event and if selected item is not of my interest, I am de-selecting it back.
I know it is not a good way, but I have no other way.
It will be good if we can have "Selection Begin" kind of event that can be vetoed. Or virtual Select() method, that I can override and change the behavior. Or a simple API to make the wxDataViewItem non-selectable.
Re: Make generic wxDataViewCtrl rows non-selectable
All these should be easy enough to implement in the generic version. But that version is only used under MSW, both GTK and OSX have their own native version and the question is if it would be possible there, too.It will be good if we can have "Selection Begin" kind of event that can be vetoed. Or virtual Select() method, that I can override and change the behavior. Or a simple API to make the wxDataViewItem non-selectable.
Use the source, Luke!
Re: Make generic wxDataViewCtrl rows non-selectable
I feel in native OSX version it is possible to make a row non-selectable. I am using the generic version on both Win and Mac.