Hi,
I just started using wxPython, I'm making a simple (but very
application-specific) file browser/launcher app.
All the user needs to do is arrow up and down the list of filenames
and select one. There is only one column. I'd like the list to
behave exactly like ListBox (and look almost exactly the same), but I
need to be able to set text and background colors individually per
item, so I have to use ListCtrl.
My main problem is that I don't know how to get the selection box of
an LC_LIST ListCtrl to go all the way across the ListCtrl. Is it
possible to get it to behave this way, or do I have to use LC_REPORT
somehow?
I'm using XRC to layout my gui, I don't have to stick with XRC, but if
it's possibly to get the functionality I want with an XRC layout I'd
like to keep it that way.
Yes, use wx.LC_REPORT and also wx.LC_NO_HEADER to get rid of the column header. Create one column and set it to have the same width as the listctrl.
···
On 7/12/11 12:26 PM, Hospadar wrote:
Hi,
I just started using wxPython, I'm making a simple (but very
application-specific) file browser/launcher app.
All the user needs to do is arrow up and down the list of filenames
and select one. There is only one column. I'd like the list to
behave exactly like ListBox (and look almost exactly the same), but I
need to be able to set text and background colors individually per
item, so I have to use ListCtrl.
My main problem is that I don't know how to get the selection box of
an LC_LIST ListCtrl to go all the way across the ListCtrl. Is it
possible to get it to behave this way, or do I have to use LC_REPORT
somehow?
Sounds good,
I presume if I want the column to remain constant with the list width I need
to catch any resize events on the listctrl and resize the column?
Or you could try the ListCtrlAutoWidthMixin in wx.lib.mixins.listctrl.
The wx.ListCtrl demo shows how to use it, and it will automagically
resize the column for you every time you resize the parent window.