[IronPython] adding items to a listview (what am I doing wrong)

Leighton Haynes LHaynes at Gemcomsoftware.com
Tue Dec 14 01:52:14 CET 2010


This looks like winforms, which I haven't used in ages, but I'm guessing that it's because you're changing the item inside the ListView's items collection, but the ListView doesn't know that the items collection has changed. You can probably set the ListView Items property to null and then back to your collection, which will result in it updating. (This isn't really an IronPython question - you'd probably be better off asking this UI stuff in a more appropriate forum).

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of robinsiebler
Sent: Tuesday, 14 December 2010 8:43 AM
To: users at lists.ironpython.com
Subject: Re: [IronPython] adding items to a listview (what am I doing wrong)




robinsiebler wrote:
> 
> I am trying to add items to a list view. Just to make sure it works, I 
> add
> 1 item when the control is created. However, when I try to add an item 
> at run-time (using the same code), the item is not added to the control:
> 
> 		item2 = ListViewItem()
> 		item2.Text = self.currGameName
> 		item2.SubItems.Add(self.currGameTrainer)
> 		item2.SubItems.Add(self.currGameExe)
> 		self._listView1.BeginUpdate()
> 		self._listView1.Items.Add(item2)
> 		self._listView1.EndUpdate()
> 
> What am I doing wrong?
> 
>  http://old.nabble.com/file/p30399194/MainForm.py MainForm.py
> 

I can't tell if the item is not being added or is just not visible. I tried
using EnsureVisible, but it didn't help.
-- 
View this message in context: http://old.nabble.com/adding-items-to-a-listview-%28what-am-I-doing-wrong%29-tp30399194p30450878.html
Sent from the IronPython mailing list archive at Nabble.com.	

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list