Hi !
I am getting error in deleting elements from a wx.ListCtrl.
My control is defined as :
self.logwin = wx.ListCtrl(panel, -1, pos=(10, 60), size=(620, 210),
style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SINGLE_SEL |
wx.LC_NO_HEADER)
I am trying to delete elements from this control as :
self.logwin.DeleteItem(self.logwin.ItemCount-1)
This approach however fails on some cases. Here, even if the
ItemCount-1 has something as seen from
self.logwin.GetItemText(self.logwin.ItemCount-1), the script fails
with the following error message :
" Could not retrieve information about list control item #itemnumber "
Is this addressable ?
I am using Windows XP and am performing multiple deletions - do the
prior deletions need to be flushed or something ?
May be you should call Arrange to rid the gaps, and the wiki example
shows a multiple deletion in a loop counting down from the higher
indice to the lower one.
···
On Thu, 8 Dec 2011 03:25:03 -0800 (PST) Sumit Bisht <sumitbisht1987@gmail.com> wrote:
This approach however fails on some cases. Here, even if the
ItemCount-1 has something as seen from
self.logwin.GetItemText(self.logwin.ItemCount-1), the script fails
with the following error message :
" Could not retrieve information about list control item #itemnumber "
Is this addressable ?
I am using Windows XP and am performing multiple deletions - do the
prior deletions need to be flushed or something ?
--
Correct. While deleting multiple items from a wx.ListCtrl, the easiest
way to go is to reverse the order (in terms of wx.ListCtrl item
indexes) in which you are going to delete the items, i.e., the last
one will be deleted first, then the next-to-last and so on...
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On 8 December 2011 18:34, Jean-Yves F. Barbier wrote:
On Thu, 8 Dec 2011 03:25:03 -0800 (PST) > Sumit Bisht <sumitbisht1987@gmail.com> wrote:
This approach however fails on some cases. Here, even if the
ItemCount-1 has something as seen from
self.logwin.GetItemText(self.logwin.ItemCount-1), the script fails
with the following error message :
" Could not retrieve information about list control item #itemnumber "
Is this addressable ?
I am using Windows XP and am performing multiple deletions - do the
prior deletions need to be flushed or something ?
May be you should call Arrange to rid the gaps, and the wiki example
shows a multiple deletion in a loop counting down from the higher
indice to the lower one.