Hello,
I use a virtual UltimateListCtrl. When I delete the last item with the
Delete-Key, I call SetItemCount with the new item-count. The item is
deleted, but the border around the item is still visible. Is there
something wrong in my code ?
wx: 2.8.12.1, MSW
Sample:
import wx
import wx.lib.agw.ultimatelistctrl as ulc
class ULCVirtual(ulc.UltimateListCtrl):
def __init__(self, parent, style, agwstyle):
agwstyle |= ulc.ULC_VIRTUAL
ulc.UltimateListCtrl.__init__(self, parent, -1,
style=style, agwStyle=agwstyle)
def OnGetItemColumnKind(self, item, column=0):
return 0
def OnGetItemText(self, item, col):
return "item {0}".format(item)
def OnGetItemToolTip(self, item, col):
return "item {0}".format(item)
def OnGetItemTextColour(self, item, col):
return wx.NullColour
def OnGetItemColumnCheck(self, item, column=0):
return False
def OnGetItemAttr(self, item_idx):
return ulc.UltimateListItemAttr()
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Test")
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
self.item_count = 5
self.ulc = ULCVirtual(self,
style=wx.NO_BORDER, agwstyle=ulc.ULC_REPORT)
for i in range(2):
self.ulc.InsertColumn(i, str(i))
self.ulc.SetItemCount(self.item_count)
sizer.Add(self.ulc, 1, wx.EXPAND)
self.ulc.Bind(wx.EVT_LIST_KEY_DOWN, self.OnKeyDown)
def OnKeyDown(self, event):
keycode = event.GetKeyCode()
if keycode == wx.WXK_DELETE:
self.item_count -= 1
self.ulc.SetItemCount(self.item_count)
event.Skip()
app = wx.PySimpleApp()
TestFrame().Show()
app.MainLoop()
Regards,
Erwin