[2.7.0] bug in wxListCtrl or undocumented feature

H H at h.com
Tue Sep 5 13:58:45 PDT 2006


In article <E1GKhUz-0001rv-00 at smtp.tt-solutions.com>,
 vadim at wxwindows.org (Vadim Zeitlin) wrote:

> On Tue, 05 Sep 2006 22:14:14 +0200 H <H at h.com> wrote:
> 
> H> The only possibility is to first remove the image list completely, add 
> H> the item and then build up from scratch the image list again. But this 
> H> is not a real solution.
> 
>  Sorry, maybe I fail to see your point, but what's wrong with setting up
> the image list first and adding items later? At least this is what I always
> do.
> 
>  Regards,
> VZ

Then, the scenario looks like:

- create and fill image list
- create and fill list
- create link between image list and list

This works as long as the image list is not empty when the list itself 
is created and filled up.
But in my case the list is filled up by user interaction. And it can 
happen that some items in the list are not associated with an image in 
the image list. So, in these cases - without any additional precautions 
from my side - it can happen that the program crashes if these items are 
entered by the user in the beginning.
Now, I found a workaround. I delay the assignment of an image list till 
the first image is actually added to the image list. This works.

Hartwig

BTW: Is there any possibility to detach the image list again from the 
list? I do not think so because passing a NULL pointer to 
AssignImageList does not clear the internal flag.
I think that this could be a useful addition.






More information about the wx-users mailing list