custom renders/editors for ListCtrl

Is there any way to use customer renders/editors in ListCtrls? What I am trying to achieve is something like the following:

1) A list with two columns, one with the name of some choice and the other with a combo box of available choices eg. Label: "Favourite Fruit", Combo Box ["orange","banana", apple"] . The label and combo box would both be populated dynamically after the form is created.

2) A list with two columns, one with a list of names and the other with a wxGauge showing some value. e.g. Label: "Oranges", wxGauge "65" (a bar filled 65%). The user could then say select a row and change the value on a nearby slider.

As far as I can tell, wxGrids can do all of this but are designed for "spreadsheet-like" 2D data, so I'm not sure I can use it for the above examples. By setting the row label size to zero I can make it sort of look like a list of items, which should work fine. But, is there any way I can do this using a ListCtrl, or is using a Grid fine really for what I want?

If anyone would like to see images of the GUI control mockups of the two descriptions above I can attach them. The GUI designer used the Mac Interface Builder with all it's snazzy Cocoa controls for mockups :slight_smile:

Thanks all for any advice on this. Although I've figured out how to do the above examples in a Grid, I'm just wondering if it's possible (or even sensible) to use a ListCtrl.

wxPython is great by the way! I was contemplating writing this app using the Eclipse Rich Client Platform but wanted to use Twisted (and Python) so moved to wxPython and not looking back!

Robert

Robert Gravina wrote:

Is there any way to use customer renders/editors in ListCtrls?

Not currently, but there is a new list-like control in development that will probably allow it.

What I am trying to achieve is something like the following:

1) A list with two columns, one with the name of some choice and the other with a combo box of available choices eg. Label: "Favourite Fruit", Combo Box ["orange","banana", apple"] . The label and combo box would both be populated dynamically after the form is created.

2) A list with two columns, one with a list of names and the other with a wxGauge showing some value. e.g. Label: "Oranges", wxGauge "65" (a bar filled 65%). The user could then say select a row and change the value on a nearby slider.

As far as I can tell, wxGrids can do all of this but are designed for "spreadsheet-like" 2D data, so I'm not sure I can use it for the above examples. By setting the row label size to zero I can make it sort of look like a list of items, which should work fine. But, is there any way I can do this using a ListCtrl, or is using a Grid fine really for what I want?

The Grid should be usable for most of what you want. It may take some tweaks in event handlers to change the behavior a bit to make it more listctrl-like, but others have taken this same path with good results.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!