I want columns with only images in the cells and cells with both text and
images.
I do this:
First I add some images to the imagelist:
self.imagelist = wxImageList(20, 12)
self.images = {
"an image": self.imagelist.Add(an_image_bitmap)
"another image": self.imagelist.Add(another_image_bitmap)
}
Then I add some columns, something like this:
info = wxListItem()
info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE | wxLIST_MASK_FORMAT
info.m_image = -1
info.m_format = 0
info.m_text = "Columnheader"
self.list.InsertColumnInfo(0, info)
self.list.InsertColumnInfo(1, info)
self.list.InsertColumnInfo(2, info)
And lastly I go on and add some items:
i = 0
for x in listdata:
# I don't want an image in the first column.
self.list.InsertImageStringItem(i, x[0], -1)
self.list.SetStringItem(i, 0, x[1], self.images["an image"])
self.list.SetStringItem(i, 1, x[2], self.images["another image"])
Now, in wxGtk everything works perfect and the images are being displayed
nicely. However, on windows the images are simply not shown. I can get
images to be shown in the first column but not in any other. The images
have been loaded, because they work when you use them together with
wxStaticBitmap().
Is this a bug in wxPython, wxWindows or in Windows?
/Ragnar Ouchterlony