[wxPython-users] Hide items in a wxListCtrl...
Robin Dunn
robin at alldunn.com
Thu Aug 30 09:40:47 PDT 2007
Stefan Holmgren wrote:
> Hi,
> Is it possible to "hide" items in a wxListCtrl?
> I'm using it as a virtual list with a large list and I want to have some
> kind of filter function for the user to select what to be visible, without
> generate a new data source list for each case....
Sure, just have something that maps from the requested item number to
the actual item number in your data. For example, if you have 10 items
in your data set, and you want to hide the 5th one, then your filter map
could be as simple as:
filter = [0, 1, 2, 3, 5, 6, 7, 8, 9]
Then when the listctrl asks for the number of items return the length of
filter instead of the actual items, and when it asks for some data
values based on some displayable index then just run that value through
the filter, like this:
self.items[self.filter[index]].text
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list