Hi, I create a ListCtrl control when the application starts, fetching
data from a DB. Then I insert some data in the DB, but I'm not able to
refresh the ListCtrl, it doesn't display the new data.
Do I have to reinstance the List ?
I have something like:
foo.addUser (new_user)
foo.cursor.commit ()
self.list.DeleteAllColumns ()
self.list.DeleteAllItems ()
self.list.populate ()
The list has a populate method that adds column labels and rows of data.
For some reason this code doesn't work, it displays again the same rows
without the new data, and this is strange, because if I comment out
DeleteAllColumns and DeleteAllItems it doubles columns and rows *with*
the new data.
Ideas ? I'd also be glad to have a cleaner way to do this ![:slight_smile: :slight_smile:](/images/emoji/apple/slight_smile.png?v=9)
TIA,
ngw
···
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
Not so easy, if you cannot provide a small smaple, but
a code fragment, what I found and works principially, looks like:
self.listCtrl1.DeleteAllItems()
items = musicdata.items()
z = 0
for x in range(self.index, self.index+10):
key, data = items[ x ]
self.listCtrl1.InsertStringItem(z, data[0])
self.listCtrl1.SetStringItem(z, 1, data[1])
self.listCtrl1.SetStringItem(z, 2, data[2])
=> self.listCtrl1.SetItemData(z, key)
z+=1
Are you sure you have a SetItemData?
···
On Wed, 23 Nov 2005 15:19:57 +0100, Nicholas Wieland <nicholas_wieland@yahoo.it> wrote:
Hi, I create a ListCtrl control when the application starts, fetching
data from a DB. Then I insert some data in the DB, but I'm not able to
refresh the ListCtrl, it doesn't display the new data.
Do I have to reinstance the List ?
I have something like:
foo.addUser (new_user)
foo.cursor.commit ()
self.list.DeleteAllColumns ()
self.list.DeleteAllItems ()
self.list.populate ()
The list has a populate method that adds column labels and rows of data.
For some reason this code doesn't work, it displays again the same rows
without the new data, and this is strange, because if I comment out
DeleteAllColumns and DeleteAllItems it doubles columns and rows *with*
the new data.
Ideas ? I'd also be glad to have a cleaner way to do this ![:slight_smile: :slight_smile:](https://discuss.wxpython.org/images/emoji/apple/slight_smile.png?v=12)
TIA,
ngw
--
Franz Steinhaeusler
- Franz Steinhaeusler :
Not so easy, if you cannot provide a small smaple, but
a code fragment, what I found and works principially, looks like:
self.listCtrl1.DeleteAllItems()
items = musicdata.items()
z = 0
for x in range(self.index, self.index+10):
key, data = items[ x ]
self.listCtrl1.InsertStringItem(z, data[0])
self.listCtrl1.SetStringItem(z, 1, data[1])
self.listCtrl1.SetStringItem(z, 2, data[2])
=> self.listCtrl1.SetItemData(z, key)
z+=1
Are you sure you have a SetItemData?
Sorry, I'm an idiot, the problem wasn't wxPython, but my __init_ method
on the list ...
Everything is ok now, thank you for your time.
ngw
···
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
- Franz Steinhaeusler :
Not so easy, if you cannot provide a small smaple, but
a code fragment, what I found and works principially, looks like:
self.listCtrl1.DeleteAllItems()
items = musicdata.items()
z = 0
for x in range(self.index, self.index+10):
key, data = items[ x ]
self.listCtrl1.InsertStringItem(z, data[0])
self.listCtrl1.SetStringItem(z, 1, data[1])
self.listCtrl1.SetStringItem(z, 2, data[2])
=> self.listCtrl1.SetItemData(z, key)
z+=1
Are you sure you have a SetItemData?
Sorry, I'm an idiot, the problem wasn't wxPython, but my __init_ method
on the list ...
Everything is ok now, thank you for your time.
You're welcome. I remembered, I also had exactly
the same problem as you, so in that way, my
suspiction was based. ![:wink: :wink:](https://discuss.wxpython.org/images/emoji/apple/wink.png?v=12)
···
On Thu, 24 Nov 2005 18:12:26 +0100, Nicholas Wieland <nicholas_wieland@yahoo.it> wrote:
ngw
--
Franz Steinhaeusler