After a lot of investigation I now know whats going on here...
The following code will bus error if SetReportView is called.
class MyList(wxPanel):
def __init__(self, parent):
wxPanel.__init__(...)
lstId = wxNewId()
self.list = wxListCtrl(self, lstId,
style=wxLC_REPORT|wx_SUNKEN_BORDER)
self.list.SetImageList(...)
....
def SetIconView(self, event):
self.list.DeleteAllItems()
self.list.SetSingleStyle(wxLC_SMALL_ICON, 1) # Works as expected
self.ReloadList()
def SetListView(self, event):
self.list.DeleteAllItems()
self.list.SetSingleStyle(wxLC_LIST, 1) # Works as expected
self.ReloadList()
def SetReportView(self, event):
self.list.DeleteAllItems()
self.list.SetSingleStyle(wxLC_REPORT, 1) # Bus error here
self.ReloadList()
The view setting methods are called by pop-up menu events. Setting the icon
or list styles
works as expected, setting the report style bus errors.
The problem is that the column headings appear to be forgotten, even when
changing to a report
view from a report view!. If the heading data is being forgotten, maybe
there is an associated
memory leak. Setting the headings immediately after the style change and
before
reloading the data fixes the problem, as below:
def SetReportView(self, event):
self.list.DeleteAllItems()
self.list.SetSingleStyle(wxLC_REPORT, 1) # Bus error here
self.list.InsertColumn(0, 'col1')
self.list.InsertColumn(1, 'col2')
self.list.InsertColumn(2, 'col3')
self.ReloadList()
Roger
···
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users