can i use a virtual listctrl from xrc

如意阁主 ruyi at i5156.net
Wed Nov 29 04:55:57 PST 2006


i load a listctrl with virtual style. it seemed that the listctrl is 
created, but no text is outpued, the method OnGetItemText has not be called.

below is the subclass:

class TestList(wx.ListCtrl):
    def __init__(self):
        pre = wx.PreListCtrl()
        self.PostCreate(pre)

        self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate)

    def OnCreate(self, evt):
        colInfo = ((u'No.', 40), (u'Status', 150))

        i = 0
        col = wx.ListItem()
        for n, w, r in colInfo:
            col.SetText(n)
            col.SetWidth(w)
            self.InsertColumnInfo(i, col)
            i += 1

        self.SetItemCount(2)

        evt.Skip()

    def OnGetItemText(self, item, col):
        return "Item %d, column %d" % (item, col)




More information about the wxpython-users mailing list