Hello,
I've got a fairly strange problem which I'm unable to solve so far.
I've created a VirtualListCtrl class which subclasses ListCtrl, but when Im
adding the VirutalListCtrl to a panel - even if I put it inside a sizer - a
duplicate widget with the "original" size of the widget will be visible over
(or sometimes under) the resized version.
As soon as I resize the window, this duplicate disappears.
This is my VirtualListCtrl code:
···
---
class VirtualListCtrl(wx.ListCtrl):
def __init__(self, parent):
wx.ListCtrl.__init__(self, parent, -1,
style=wx.LC_REPORT|
wx.LC_VIRTUAL|
wx.LC_HRULES|
wx.LC_VRULES|
wx.SUNKEN_BORDER)
self.parent = parent
self.InsertColumn(0, 'Timestamp')
self.InsertColumn(1, 'Name')
self.InsertColumn(2, 'Level')
self.InsertColumn(3, 'Message')
self.SetColumnWidth(0, 200)
self.SetColumnWidth(1, 100)
self.SetColumnWidth(2, 100)
self.SetColumnWidth(3, 400)
---
I am adding the ListCtrl to my panel using:
self.listCtrl = VirtualListCtrl(self.panel)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.listCtrl, 1, wx.EXPAND|wx.GROW)
self.panel.SetSizer(sizer)
self.panel.SetAutoLayout(True)
Attached is a screencapture of the effect Im seeing. As soon as I resize the
window, the "duplicate" widget will disappear and everything is normal.
I've tried every Refresh() and Update() I can think of, and nothing seems to
fix this issue.
Thanks for any suggestion.
Best regards,
Frank