Hiya,
Move the CreateCheckStateColumn to after the SetColumns method.
--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Daniel Hyams
On 2/26/2013 6:28 PM, Mike Driscoll wrote:
Hi,
I'm trying to figure out how to insert a checkbox in the ObjectListView widget. According to http://objectlistview.sourceforge.net/python/recipes.html?highlight=checkbox#recipe-checkbox I am supposed to be able to use the CreateCheckStateColumn() method, but that doesn't appear to work for me. I have attached a small runnable example. Can anyone see what I'm doing wrong?
I am using Python 2.6.6 on Windows 7 with wxPython 2.8.12.1
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.
Hi,
I do use checkboxes in ObjectListView, but I never tried CreateCheckStateColumn(). I do insert the checkbox when creating the column object. Example:
myColumn = ColumnDefn(myColTitle, "center",
valueGetter="attributeValue",
valueSetter=self.myValueMethod,
checkStateGetter="attributeBool",
checkStateSetter=self.myCheckBoxMethod)
where 'attributeValue' is the value to be passed to the row (so, for example, an attribute of the list of object you want to display), 'self.myValueMethod' is the method that is run when entering a new value, 'attributeBool', the bool value for the check box (also an attribute of the object for example), 'self.myCheckBoxMethod' the method that is run when clicking on the check box.
In your code, this would go in self.resultsOlv.SetColumns(). It is not required to have 'valueSetter' and 'valueGetter'. Just make the column narrow enough so that only the check box is displayed, if nothing is to be seen nearby the check box.
It works well, but I'm not sure this is the answer you are hoping for ...
Raphael
--
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.
On 2/26/2013 6:28 PM, Mike Driscoll wrote:
> Hi,
>
> I'm trying to figure out how to insert a checkbox in the
> ObjectListView widget. According to
> http://objectlistview.sourceforge.net/python/recipes.html?highlight=checkbox#recipe-checkbox
> I am supposed to be able to use the CreateCheckStateColumn() method,
> but that doesn't appear to work for me. I have attached a small
> runnable example. Can anyone see what I'm doing wrong?
>
> I am using Python 2.6.6 on Windows 7 with wxPython 2.8.12.1
>
> 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-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Hi,
I do use checkboxes in ObjectListView, but I never tried
CreateCheckStateColumn(). I do insert the checkbox when creating the
column object.
Example:
myColumn = ColumnDefn(myColTitle, "center",
valueGetter="attributeValue",
valueSetter=self.myValueMethod,
checkStateGetter="attributeBool",
checkStateSetter=self.myCheckBoxMethod)
where 'attributeValue' is the value to be passed to the row (so, for
example, an attribute of the list of object you want to display),
'self.myValueMethod' is the method that is run when entering a new
value, 'attributeBool', the bool value for the check box (also an
attribute of the object for example), 'self.myCheckBoxMethod' the method
that is run when clicking on the check box.
In your code, this would go in self.resultsOlv.SetColumns(). It is not
required to have 'valueSetter' and 'valueGetter'. Just make the column
narrow enough so that only the check box is displayed, if nothing is to
be seen nearby the check box.
It works well, but I'm not sure this is the answer you are hoping for ...
Raphael
Hi Mike,
Hope didn't confuse you with my last answer, as I was not answering your
question:-[ .
I thought you wanted to show a checkbox for a boolean value and not
activate the option to select multiple objects in the list.
I needed to get my mind of a problem I can't find in my code, so had a
look at medialocker and made a few updates.
1. to activate a checkstatecolum you can now just do:
e.g. in mlsrc.controllers.base_list.setUpOlv:
self.theOlv.initOLV(self.modelName, checkstatecol=1)
2. I added a demo column for boolean value to be represented as a
checkbox in the list.
Note that the current code of MediaLocker has problems with 2.9.x, so I
force it to use 2.8. The problems are probably to do with some sizing
issue for the search controls, had the same in my own stuff, so when I
have a moment I will look at this and will push a fix.
Werner