Hi everyone,
I'm trying to use the class ultimatelistctrl (win xp, python 2.6, wx
2.8), but I'm encountering some problems....my aim is to realize an
editable virtual list. So far I've written the following code:
import wx
try:
from agw import ultimatelistctrl as ULC
except ImportError: # if it's not there locally, try the wxPython lib.
from wx.lib.agw import ultimatelistctrl as ULC
class AttListCtrl(ULC.UltimateListCtrl) :
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0,
agwStyle=0) :
ULC.UltimateListCtrl.__init__(self, parent, id, pos, size,
style, agwStyle)
self.InsertColumn(0, "Name")
self.InsertColumn(1, "Event")
self.InsertColumn(2, "Source")
self.SetColumnWidth(0, 120)
self.SetColumnWidth(1, 500)
self.SetColumnWidth(2, 150)
self.SetItemCount(10)
def OnGetItemText(self, item, col):
return "Item %d, column %d" % (item, col)
def ResetView(self) :
self.SetItemCount(10)
self.Refresh()
class AttDescWin(wx.Frame) :
def __init__(self, parent) :
wx.Frame.__init__(self, parent, -1, size=wx.Size(1050, 750))
self.att_list_ulc = AttListCtrl(self, -1,
agwStyle=wx.LC_REPORT
> wx.LC_VIRTUAL
#| wx.BORDER_SUNKEN
#| wx.BORDER_NONE
> wx.ULC_EDIT_LABELS
#| wx.LC_SORT_ASCENDING
#| wx.LC_NO_HEADER
#| wx.LC_VRULES
#| wx.LC_HRULES
#| wx.LC_SINGLE_SEL
#|
ULC.ULC_HAS_VARIABLE_ROW_HEIGHT
)
class MyApp(wx.App) :
def OnInit(self) :
frame = AttDescWin(None)
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(0)
app.MainLoop()
The list is correctly created, but the items are not editable in spite
of the flag wx.ULC_EDIT_LABELS. Am I doing something wrong or are
virtual list not intended to be editable? Thanks in advance for your
help!