This is pretty bizarre. It almost has to be programmer error, but I can
use some guidance in debugging it. MS Windows, of course.
What I really want to do is to put an image in column 1, but in figuring
out exactly how to do that I discover that I can't even get one to appear
in column 0 -- except it did appear once!
I've done pretty much what the wxListCtrl demo does: create an image list,
stick a couple of images in it, set the image list for the control. Then
at the point where I'm adding something to the list, I call
InsertImageStringItem(i, name, j) where j is the index in the image list of
the image I want displayed.
Okay. The first time I tried this, I used an explicit '0' for j. No image
appeared, although *space* for the image was there.
Then, trying to make my code as close to the demo as possible, I assigned
the return value from the Add() method for the image to an instance
variable. Like,
self.MyImageIndex = imageList.Add(MyBitmap)
Then when inserting the item I called
InsertImageStringItem(i, name, self.MyImageIndex)
This should not, of course, have made any difference (especially since I
verified that self.MyImageIndex was 0). But it *did* make a difference!!
The image displayed just fine.
Hmmm, I thought. I've got to reproduce this. And I changed things back.
The image failed to appear. Hmmm again. I changed things back to using
the assignment and self.MyImageIndex as the parameter. The image still
failed to appear.
And now I can't get the image to appear no matter what. However, there is
still blank space where the image ought to be.
So the image did appear on *one* run of the code. But I can't get it to
happen again. The image is 16x16 and I've tried both a PNG and a BMP
(which I get by using wxBitmap() on a file of the appropriate sort. The
image list is defined as wxImageList(16,16) as well.
Any hints at tracking down this problem will be appreciated.
···
--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456