Does anyone know how to catch the check/uncheck event in the ObjectListView widget when it has checkboxes enabled? See http://objectlistview.sourceforge.net/python/recipes.html#recipe-checkbox to know what I’m talking about. I need a way to allow the user to select a single row for editing where the cells themselves are editable, but disallow other rows from being edited.
What would be most beneficial is to just use a radio box instead of a check box, but I don’t think that’s possible in this widget, correct?
Not sure this will answer your needs, but just an idea: instead of using CreateCheckStateColumn to have your check box, use a 'Data-based checkbox' (this is explained lower in the web page you mention). With this, the value of the check box can be an attribute of the object corresponding to the row. And when checking it on, you can turn 'off' the attribute value for all the other objects in the list, and vice versa.
Also, if you would prefer to see a radio button, you can make one yourself and use:
self.AddNamedImages(lsm.OLV.NAME_CHECKED_IMAGE, your_image)
to replace the check box image (same for NAME_UNCHECKED_IMAGE)
or if you don't want to replace the check box image, you can create icons for the radio button:
self.AddNamedImages("radioButton_on", your_radioButton_on_image)
and use it when defining the column:
def getRadioImage(self, item):
if item.yourRadioButtonAttribute:
return 'radioButton_on'
else:
return 'radioButton_off'
def onRadioButton(self, yourObjectListViewObject, rowIndex, subItemIndex):
item = yourObjectListViewObject.GetSelectedObject()
# ...
# Do what you need to do here
Raphael
···
On 4/23/2013 5:06 PM, Mike Driscoll wrote:
Hi,
Does anyone know how to catch the check/uncheck event in the ObjectListView widget when it has checkboxes enabled? See Learning to cook — ObjectListView v1.2 documentation to know what I'm talking about. I need a way to allow the user to select a single row for editing where the cells themselves are editable, but disallow other rows from being edited.
What would be most beneficial is to just use a radio box instead of a check box, but I don't think that's possible in this widget, correct?
Thanks,
Mike
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Also, if you would prefer to see a radio button, you can make one
yourself
Just a note: Screen reader users use the arrow keys to change the value
of radio buttons. They also use them to navigate through list views.
So I would advise against this if accessibility is something you care about.