How to refresh an empty Virtual ListCtrl?

Hello,

This seems like a really simple question, but i have struggled to find
an answer.

I have a virtual ListCtrl of 4 items in it. I am removing the items
one at a time. I see each item removed, with the remaining left in
the list, but when I remove the last item, the list will not redraw
itself and erase the final item.

Here is what I am doing on a delete:

            size = len( elements )
            self.RefreshItems( 0, len( elements )-1)
            self.SetItemCount( size )

I thought calling the RefreshItems command would force the redraw?

If I drag another application's window overtop of the virtual list and
back, I see the list empty as it should be.

So how can I force a redraw?

Thanks,

John

*From:* John W <jmw136@gmail.com>
*To:* wxPython-users@lists.wxwidgets.org
*Date:* Thu, 18 Aug 2005 17:40:14 -0500

Hello,

This seems like a really simple question, but i have struggled to find
an answer.

I have a virtual ListCtrl of 4 items in it. I am removing the items
one at a time. I see each item removed, with the remaining left in
the list, but when I remove the last item, the list will not redraw
itself and erase the final item.

Here is what I am doing on a delete:

            size = len( elements )
            self.RefreshItems( 0, len( elements )-1)
            self.SetItemCount( size )

I thought calling the RefreshItems command would force the redraw?

If I drag another application's window overtop of the virtual list and
back, I see the list empty as it should be.

So how can I force a redraw?

Thanks,

John

The range of items you are refreshing is always one less than the number
of items currently being displayed, so I'm surprised it works at all,
unless self.RefreshItems is doing more for you than you think : You have 4
items and delete 1, so len(elements)-1 = 2 and when you remove the last
item, your range is 0 to -1 and self.RefreshItems is probably not going to
respond at all.

David