wx.ListCtrl - I do not see the inserted item

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Laszlo Nagy

    #1

    wx.ListCtrl - I do not see the inserted item

    This is a ListCtrl descendant:

    class MegaListCtrl(wx .ListCtrl):
    <more code here....>

    def InsertImageStri ngItem(self, index, label, imageIndex):
    imageIndex =
    self.imagelists[wx.IMAGE_LIST_S MALL].GetIndexByName (imageIndex)
    print index,imageInde x,label,imageIn dex
    super(MegaListC trl,self).Inser tImageStringIte m(index, label,
    imageIndex)

    <more code here....>

    Here I create the list control instance:

    lst = self.lstExtTabl es = MegaListCtrl(pn l,-1,style=wx.LC_R EPORT)

    info = wx.ListItem()
    info.m_mask = wx.LIST_MASK_TE XT | wx.LIST_MASK_IM AGE |
    wx.LIST_MASK_FO RMAT
    info.m_image = -1
    info.m_format = 0
    info.m_text = _("Table name")
    lst.InsertColum nInfo(0, info)
    sizer.Add(lst,p roportion=1,fla g=wx.EXPAND)

    <more code here....>

    Here I try to add some items:

    if not extdbdef is None:
    for tblref in extdbdef.tables :
    tbl = tblref()
    if not tbl is None:
    print str(tbl.name)
    lst.InsertImage StringItem(sys. maxint,
    str(tbl.name), 'table')


    This is the output of the program:

    C:/Python24/pythonw.exe -u "T:/Python/Lib/mess/utils/DbSchemaDesigne r.py"
    client
    2147483647 248 client 248
    jn_client
    2147483647 248 jn_client 248


    However, the ListCtrl displays empty. I can see the gray column header,
    but it has not text. The two items are probably added, because
    InsertImageStri ngItem did not raise an exception, but the items are not
    visible.

    Do you have an idea what can be the problem?

    Thanks,

    Laszlo

Working...