How to properly implement new wxDataViewListCtrl widget?

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 properly implement new wxDataViewListCtrl widget?

Post by diasat »

I want to create a widget MyWidget that is a wxDataViewListCtrl, but has predefined columns (ID number, bitmap, text, button). Each row would represent data from some FileClass object and there should be a function to append the FileClass to the widget such that it automatically constructs each new row from the data in FileClass. How should I do this?

One idea I have is to have MyWidget inherit from wxDataViewListCtrl and add the predefined columns in the constructor. Then override the AddItem, DeleteItem and other methods. Though, this seems as a bad ideas as it leaves incompatible base methods exposed (such as the ones for deleting and adding new columns, because MyWidget should have immutable columns)
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to properly implement new wxDataViewListCtrl widget?

Post by doublemax »

When you derive from wxDataViewListCtrl, you don't have to make the base class public.
Use the source, Luke!
Post Reply