I am using a ListCtrl which is loaded with data by selecting an item in another ListCtrl.
My code is basically what is in the listCtrl demo (thanks Robin for providing the demo ). I want the second list sorted (using the mixin), so to make it work I had to move the following three lines into the populateList function which I call from the second list control's validator.TransferToWindow function.
self.itemDataMap = self.musicdata
wxColumnSorterMixin.__init__(self, 3)
self.SortListItems(2, True) # sort by col 2
- Updating itemDataMap is obvious as the data changed.
- But is it correct (or will it bite me at some point) to call wxColumnSorterMixin.__init__ each time, when I didn't I did get an instance has no attribute "_col" error when I called SortListItems.
If what I do is fine, I like to suggest to move these lines in the demo to the end of populateList.
I am using a ListCtrl which is loaded with data by selecting an item in another ListCtrl.
My code is basically what is in the listCtrl demo (thanks Robin for providing the demo ). I want the second list sorted (using the mixin), so to make it work I had to move the following three lines into the populateList function which I call from the second list control's validator.TransferToWindow function.
self.itemDataMap = self.musicdata
wxColumnSorterMixin.__init__(self, 3)
self.SortListItems(2, True) # sort by col 2
- Updating itemDataMap is obvious as the data changed.
- But is it correct (or will it bite me at some point) to call wxColumnSorterMixin.__init__ each time, when I didn't I did get an instance has no attribute "_col" error when I called SortListItems.
The only problem I see is that the __init__ binds the EVT_LIST_COL_CLICK event so calling it multiple times will result in additional bindings of the handler to the listctrl.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!