wxListCtrl vs wxGrid

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
macdonjo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sun Feb 09, 2014 8:01 pm

wxListCtrl vs wxGrid

Post by macdonjo »

Hi,

I'm just wondering what the big differences between wxListCtrl and wxGrid are?

My uses: The program adds and edits the data throughout the program. The indexes are not numbers, but rather strings, and they are unique. The users never edits the data manually. At the end, the data is either just read by user or exported to spreadsheet.

I've used wxGrid but I just saw an example of wxListCtrl, which is graphically much neater. Just wondering if I show start using wxListCtrl.

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

Re: wxListCtrl vs wxGrid

Post by doublemax »

wxGrid is more flexible, because you can edit data in each cell, you can have different editors and different renderers for each cell. Therefore it's more complex and more difficult to use.

If you have only data that can be displayed as text and you don't need to edit the data directly in the control, a (virtual) wxListCtrl might be the better choice for you.

Another option could be wxDataViewCtrl / wxDataViewListCtrl
Use the source, Luke!
iwbnwif
Super wx Problem Solver
Super wx Problem Solver
Posts: 282
Joined: Tue Mar 19, 2013 8:52 pm

Re: wxListCtrl vs wxGrid

Post by iwbnwif »

Interesting topic and a nice succinct answer from doublemax.

Actually I would like to make a comparison matrix and put it up on the wxwiki. On one axis would be the class name and on the other a list of features with the option to add notes.

The types of controls I can think of including are:
  • wxGrid
  • wxListCtrl
  • wxListView
  • wxTreeCtrl
  • wxTreeListCtrl
  • wxDataViewCtrl
  • wxDataViewListCtrl
  • wxDataViewTreeCtrl
The attributes I can think of off the top of my head are (in no particular order):
  • Native control
  • Native column headers
  • Native row headers
  • Separate data model
  • Built in data model
  • Custom renderer (per cell)
  • Custom renderer (per table)
  • Variable row height
  • Variable column width
  • Tree
  • Per cell font control
  • Per row font control
  • Per cell text colour control
  • Per cell font colour control
  • Column spanning
  • Row spanning
  • Combobox cells
  • Checkbox cells
  • Custom editor (per cell)
  • Custom editor (per table)
Please help me to build these lists and I will start to make the matrix, or let me know if one already exists and I have missed it.

There is also this control http://twinforms.com/products/wxwidgets ... stctrl.php which I haven't included because AFAIK it is not part of the core library. My interest in this particular control is that the node row can column span like Outlook's group by date feature.
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
sebastians
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Oct 14, 2017 2:42 pm

Re: wxListCtrl vs wxGrid

Post by sebastians »

Does this comparison matrix exist anywhere, by now?

In particular, I'd like to know which control is native on which platform.

What I found so far:
http://www.tt-solutions.com/img/slides/tables_comp.pdf (linked from https://stackoverflow.com/a/33064902/1413374)
https://comp.soft-sys.wxwindows.narkive ... ctrl#post6

But I don't know if those are up-to-date, or if for example the design of wxDataViewCtrl has changed in the meantime.

Regards,
Sebastian
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxListCtrl vs wxGrid

Post by doublemax »

The image from the first link seems about right and still valid.
Use the source, Luke!
Post Reply