wx.ListCtrl.SetSingleStyle causes ClearAll?

wxGTK, wxPython-2.4.2.4 (don't laugh at me, Gentoo Linux still thinks
the 2.6.x.x versions is unstable)

I use a wx.ListCtrl to display a bunch of data. I'd like to toggle the
display style between wx.LC_LIST and wx.LC_REPORT when user press
toolbar buttons to get summary/detailed views. I use the following code
snippet:

def on_button_detail(self, evt):
    self.listctrl.SetSingleStyle(wx.LC_REPORT)

def on_button_icon(self, evt):
    self.listctrl.SetSingleStyle(wx.LC_LIST)

But I find every time the button is pressed, all the data in listctrl
disappeared, as if a ClearAll() is called. Is this a feature or bug?
How can I workaround?

Thanks in advance.

···

--
Qiangning Hong

__________________________________________________________
( About the only thing we have left that actually )
( discriminates in favor of the plain people is the stork. )
----------------------------------------------------------
  o
   o
      /\_)o<
     > \
     > O . O|
      \_____/

Qiangning Hong wrote:

wxGTK, wxPython-2.4.2.4 (don't laugh at me, Gentoo Linux still thinks
the 2.6.x.x versions is unstable)

I use a wx.ListCtrl to display a bunch of data. I'd like to toggle the
display style between wx.LC_LIST and wx.LC_REPORT when user press
toolbar buttons to get summary/detailed views. I use the following code
snippet:

def on_button_detail(self, evt):
    self.listctrl.SetSingleStyle(wx.LC_REPORT)

def on_button_icon(self, evt):
    self.listctrl.SetSingleStyle(wx.LC_LIST)

But I find every time the button is pressed, all the data in listctrl
disappeared, as if a ClearAll() is called. Is this a feature or bug?
How can I workaround?

Probably the only workaround is to add your items to the list again after you have changed the style. I havn't tried this yet, but from the code it looks like it may be platform dependent. The generic listctrl used on GTK and Mac does delete everything, but I don't see a coresponding call in the MSW version...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!