Deny rows deselection in wxDataViewListCtrl 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
rudolfninja
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Aug 28, 2018 1:02 pm
Location: Belarus

Deny rows deselection in wxDataViewListCtrl

Post by rudolfninja »

Hi,
Is there a way to deny deselection of the row? If I click on empty area of the control, then selected row will be deselected, but I need at lease one row to be selected. So the question ho to disable deselection and in case of clicking on empty area of the control just do nothing?
I tried to handle wxEVT_DATAVIEW_SELECTION_CHANGED event, but there is no way to get previously selected row.
The only variant I see is to store selected row index as a class member and update it on every successful wxEVT_DATAVIEW_SELECTION_CHANGED event.
But may be there is a way to do it with native wxDataViewListCtrl methods or properties.

Thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Deny rows deselection in wxDataViewListCtrl

Post by doublemax »

The only variant I see is to store selected row index as a class member and update it on every successful wxEVT_DATAVIEW_SELECTION_CHANGED event.
I think that's the only way to do it.
Use the source, Luke!
rudolfninja
Earned some good credits
Earned some good credits
Posts: 107
Joined: Tue Aug 28, 2018 1:02 pm
Location: Belarus

Re: Deny rows deselection in wxDataViewListCtrl

Post by rudolfninja »

Thank you. Will implement this solution.
Post Reply