How to add button column to 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
diasat
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Jul 04, 2021 6:30 am

How to add button column to wxDataViewListCtrl?

Post by diasat »

It's useful to be able to have a button column (up/down arrow buttons for moving rows, X button for deleting row, etc.) so how do I add a button column to a wxDataViewListCtrl?

One way is to use the wxDataViewIconText column without the text and use EVT_LEFT_UP to trigger a button press, but it seems very hacky to me and not ideal.

Another way is to write a custom renderer for a wxDataViewColumn that acts like a button, but that's pretty conplicated for such a simple task of adding a button.

So is there any simple way to add a button column that looks like a native wxButton (and ideally IS a wxButton)? Thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to add button column to wxDataViewListCtrl?

Post by doublemax »

diasat wrote: Sun Jul 04, 2021 6:43 am So is there any simple way to add a button column that looks like a native wxButton (and ideally IS a wxButton)? Thanks.
No. And you've correctly described the best two options.

wxRendererNative can help to draw a real looking button.
https://docs.wxwidgets.org/trunk/classw ... ative.html
Use the source, Luke!
Post Reply