Issues setting items for a multicolumn listctrl

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon Oct 1 13:33:56 PDT 2007


Hi Dan, 

> -----Original Message-----
> From: Dan Eloff [mailto:dan.eloff at gmail.com] 
> Sent: Monday, October 01, 2007 1:36 PM
> To: wxPython-users at lists.wxwidgets.org
> Subject: Issues setting items for a multicolumn listctrl
> 
> Inserting items with:
> 
>             if col:
>                 self.InsertColumnItem(col, item)
>             else:
>                 self.InsertItem(item)
> 
> In a loop. The items have Text associated with them, but once 
> they've been added, only the first item, added via InsertItem 
> has Text. The others have u'' as the Text. I retain a 
> reference to the actual ListItem object and I can still call 
> item.Text afterwards and verify that it has Text, but the 
> item in the ListCtrl does not.
> 
> What's going on here?
> 
> Thanks,
> -Dan
> 

I use InsertStringItem() to insert an item and SetStringItem() method to
put text into specific "columns" in the wx.ListCtrl. The WIA book says
that  InsertItem is used internally by the list control to manage
information. I don't really understand it all, but I don't think it's what
you want. It seems to retain previously created items in memory and that's
why I assume you can query your text. If you have the book, see page 403.

Mike





More information about the wxpython-users mailing list