Andrea,
(This may be of some interest for people who are frequently asking about
wx.ListCtrl, ObjectListView, UltimateListCtrl)
Now, elaborating, and sorry if this is a bit long.
First, I'm by far not an expert, and probably quickly hits walls that
experienced users would not.
Now, I need to display a list that can have a few thousands rows and a
few tens columns. The data are from a list of dictionaries, where each
dictionary is a row (an "item"), and each key in the dictionary is a
column (a "sub-item"). Columns display would be customisable, but there
would be no column dragging (for now at least). Very important: each
cell (?sub-item") could be edited (and NOT just the item "Label"), and
the editor type would be defined by column. Also important, I'd like to
play with cell background colour, add icons in cells left or right
aligned, but with no fixed, width, possibly also play with text format
(bold, colour). The editors I forsee are: text ctrl, checkbox,
combobox, any kind of dialog (like color dialog). Sorting on some
columns would be cool too, as well as basic search features.
I know, wx.Grid is a solution, but I wanted to avoid all the work around
custom renderer and custom editors, also there are several things
described above that would need to be coded.
I tried ObjectListView which is really great, and does *almost*
everything I need in a very slick way. Especially, the populating of the
list is great, as well as the setup of columns and cell editors. The
"FastObjectListView" is doing its impressive "fast" job. Appreciated too
the built in "sort", the search ctrl that's comes with the demo etc. But
it has two limitations: fixed size of images (and not right alignement),
no "per sub-item" background color and text color/font. And I understand
this is because it is derived from wx.ListCtrl.
So, I tried UltimateListCtrl, very impressive, but got a few problems
doing what I want: here are the most important:
- The sub-item editing is limited to the first "Label" column. I wrote
my own class to have the ExpandoTextCtrl come on double click for each
cell. Had to figure out what is the UltimateListCtrl object vs. the
UltimateListMainWindow object and how the methods are calling each
other, but after some sweat, that works ok now.
- I got pretty frustrated with the item._* attributes. I could retrive
the text info (or background colour) of a sub-item, but not the data
(._data) or pyData. Seems like we can give a text value per sub-item,
but no data, this can go to the first sub-item in the row only. I'm
probably missing something here, but in general, I found that ULC is
still close to wx.ListCtrl in that it is based mostly on what's in the
"Label" column. I really need something where the first column is
nothing different than the other columns.
- Tried to add a combobox in each cell of a column. Easy to be shown,
but with 1000 items, I would create 1000 comboBox objects with 1000
associated event handlers ... Exactly what I'd like to avoid. So,
started to created a custom renderer, and a custom editor ... well,
that's like using wx.Grid, isn't it.
In conclusion, I still think the class is great, but may be not
appropriate to my needs.
So, I think I guess I need to just into wx.Grid, or forget about
background colors and text color in cells. Too bad, because all those
3rd party classes are really great, and just missing a small bit.
Anyway thanks for all the work.
Raphael