L
Laszlo Nagy
This is a ListCtrl descendant:
class MegaListCtrl(wx.ListCtrl):
<more code here....>
def InsertImageStringItem(self, index, label, imageIndex):
imageIndex =
self.imagelists[wx.IMAGE_LIST_SMALL].GetIndexByName(imageIndex)
print index,imageIndex,label,imageIndex
super(MegaListCtrl,self).InsertImageStringItem(index, label,
imageIndex)
<more code here....>
Here I create the list control instance:
lst = self.lstExtTables = MegaListCtrl(pnl,-1,style=wx.LC_REPORT)
info = wx.ListItem()
info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE |
wx.LIST_MASK_FORMAT
info.m_image = -1
info.m_format = 0
info.m_text = _("Table name")
lst.InsertColumnInfo(0, info)
sizer.Add(lst,proportion=1,flag=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.InsertImageStringItem(sys.maxint,
str(tbl.name), 'table')
This is the output of the program:
C:/Python24/pythonw.exe -u "T:/Python/Lib/mess/utils/DbSchemaDesigner.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
InsertImageStringItem did not raise an exception, but the items are not
visible.
Do you have an idea what can be the problem?
Thanks,
Laszlo
class MegaListCtrl(wx.ListCtrl):
<more code here....>
def InsertImageStringItem(self, index, label, imageIndex):
imageIndex =
self.imagelists[wx.IMAGE_LIST_SMALL].GetIndexByName(imageIndex)
print index,imageIndex,label,imageIndex
super(MegaListCtrl,self).InsertImageStringItem(index, label,
imageIndex)
<more code here....>
Here I create the list control instance:
lst = self.lstExtTables = MegaListCtrl(pnl,-1,style=wx.LC_REPORT)
info = wx.ListItem()
info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE |
wx.LIST_MASK_FORMAT
info.m_image = -1
info.m_format = 0
info.m_text = _("Table name")
lst.InsertColumnInfo(0, info)
sizer.Add(lst,proportion=1,flag=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.InsertImageStringItem(sys.maxint,
str(tbl.name), 'table')
This is the output of the program:
C:/Python24/pythonw.exe -u "T:/Python/Lib/mess/utils/DbSchemaDesigner.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
InsertImageStringItem did not raise an exception, but the items are not
visible.
Do you have an idea what can be the problem?
Thanks,
Laszlo