468,257 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

wxPython: combining wxListCtrl and wxCheckBox

I would like a wxListCtrl with 3 columns in it. The number of rows in
it will vary during run-time. In the first column of each row should
be a wxCheckBox, which the user can check or uncheck.

Is such an arrangement possible?
Any example source code?

wxCheckListBox comes close - but not close enough. Unfortunately, it
does not derive from wxListCtrl, which contains the function
InsertColumn() needed for multiple columns
Jul 18 '05 #1
1 3888
One way to do this is to use the capability of the ListCtrl to display
images in the first position in the row. You can create checked and
unchecked images and then insert whichever image is appropriate for a
given row in the List.

When the row is created,
LCtrl.InsertImageStringItem(...) can insert the appropriate image and
you can then add as many additional columns as you need with
LCtrl.SetStringItem(row, column, string)

If some event changes the checkbox status of a row:

LC_Item = LCtrl.GetItem(row)

if __some condition__:
LC_Item.SetImage(index_unchecked)
else:
LC_Item.SetImage(index_checked)

LCtrl.SetItem(LC_Item)
ca**********@ukmail.com (Mark Carter) wrote in message news:<d3*************************@posting.google.c om>...
I would like a wxListCtrl with 3 columns in it. The number of rows in
it will vary during run-time. In the first column of each row should
be a wxCheckBox, which the user can check or uncheck.

Is such an arrangement possible?
Any example source code?

wxCheckListBox comes close - but not close enough. Unfortunately, it
does not derive from wxListCtrl, which contains the function
InsertColumn() needed for multiple columns

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andrew | last post: by
1 post views Thread by Chad Haynes | last post: by
15 posts views Thread by Grant Edwards | last post: by
3 posts views Thread by Piet | last post: by
4 posts views Thread by Piet | last post: by
1 post views Thread by Fabio Pliger | last post: by
reply views Thread by David Poundall | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.