I’m playing around with a virtual wx.ListCtrl to see about how feasible it will be to replace our usage of wx.Grid, since we have a bunch of problems with wx.Grid in our application. Since we’re entirely read-only and row-oriented as opposed to cell-oriented, we can almost get the Grid to work just the way we’d like-- but never entirely, to the point where there’s a lot of grumbling over little usability things. (For example, selection has always been a problem. Anyhoo!) The best way to imagine how the app is supposed to work is a file system folder on List view; columns are for informational purposes only and can’t be independantly selected/acted upon, etc.
So far, there’s a lot of promiss with wx.ListCtrl as a replacement. Selection automatically works perfectly, I can configure the columns dynamically like I want, and everything’s nice. However, we are of course losing some “customizability”-- which I expected, I’m just wondering if there’s ways around it.
One thing we had previousely was certain columns were color-coded by their value. The first cell might be red if it represents a status of “Overdue”; it might be Green otherwise. Since there are not “per-column” attrs in the wx.ListCtrl, I was wondering if anyone had any other ideas for how such a thing would be accomplished.
I thought of constructing an image with a solid color, and then drawing the status on top of it, then passing that back from GetItemImage. The only problem was, I already had an image I wanted to display-- a filetype icon-- but there’s no reason I can’t draw that on top of the colored background too, I suppose.
I also thought of just colorizing the text – but can’t seem to do that to a single column.
So! Anyone have any ideas for an approach I might be missing?
I'm playing around with a virtual wx.ListCtrl to see about how feasible it will be to replace our usage of wx.Grid, since we have a bunch of problems with wx.Grid in our application. Since we're entirely read-only and row-oriented as opposed to cell-oriented, we can almost get the Grid to work just the way we'd like-- but never entirely, to the point where there's a lot of grumbling over little usability things. (For example, selection has always been a problem. Anyhoo!) The best way to imagine how the app is supposed to work is a file system folder on List view; columns are for informational purposes only and can't be independantly selected/acted upon, etc.
So far, there's a lot of promiss with wx.ListCtrl as a replacement. Selection automatically works perfectly, I can configure the columns dynamically like I want, and everything's nice. However, we are of course losing some "customizability"-- which I expected, I'm just wondering if there's ways around it.
One thing we had previousely was certain columns were color-coded by their value. The first cell might be red if it represents a status of "Overdue"; it might be Green otherwise. Since there are not "per-column" attrs in the wx.ListCtrl, I was wondering if anyone had any other ideas for how such a thing would be accomplished.
In 2.8 you can specify an icon for all columns, not just the first like in previous releases, so you can use the icon as the status indicator in each cell.
I thought of constructing an image with a solid color, and then drawing the status on top of it, then passing that back from GetItemImage. The only problem was, I already had an image I wanted to display-- a filetype icon-- but there's no reason I can't draw that on top of the colored background too, I suppose.
I also thought of just colorizing the text -- but can't seem to do that to a single column.
Correct. Basically the difference in paradigm is that in a ListCtrl an "item" is the whole row, while in a Grid an "item" is each cell.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
One thing we had previousely was certain columns were color-coded by
their value. The first cell might be red if it represents a status of
“Overdue”; it might be Green otherwise. Since there are not “per-column”
attrs in the wx.ListCtrl, I was wondering if anyone had any other ideas
for how such a thing would be accomplished.
In 2.8 you can specify an icon for all columns, not just the first like
in previous releases, so you can use the icon as the status indicator in
each cell.
Ooh, OnGetItemColumnImage. Never noticed that. Perfect. Thanks!