[wxPython-users] get wxListCtrl from wxListItem?

Robin Dunn robin at alldunn.com
Tue Jan 2 12:44:23 PST 2007


Pangborn, Andrew (ext. 324) wrote:
> I'm using multiple list controls as elements on a CustomTreeCtrl...so
> I would still need some way of determining what listctrl the Listitem
> belonged to. I am able to get the value from the listCtrl cell that
> was edited with event.GetText(), its just a matter of getting a
> reference to the proper python data object so that I can persist
> changes to my model. It's pretty easy for me to tack on a pyData
> object to the listctrl, but I don't really know how to tack a pyData
> object onto the listitem. I'm using listCtrl.SetStringItem, which
> seems to create the ListItem internally without returning a
> reference.

The wx.ListItem is just a temporary handle that the listctrl uses to 
identify an item, and to transfer information about the item, however it 
assumes that you know which listctrl you are dealing with.  If the event 
you are needing this for is from the listctrl then you can use 
event.GetEventObject to get the listctrl the event is coming from.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list