[2.7.0] bug in wxListCtrl or undocumented feature
H
H at h.com
Tue Sep 12 09:24:36 PDT 2006
In article <E1GMENE-0006HS-00 at smtp.tt-solutions.com>,
vadim at wxwindows.org (Vadim Zeitlin) wrote:
> On Tue, 05 Sep 2006 22:58:45 +0200 H <H at h.com> wrote:
>
> H> Then, the scenario looks like:
> H>
> H> - create and fill image list
> H> - create and fill list
> H> - create link between image list and list
>
> I could be missing something but I think the only real constraint is that
> the first step must be done first. But you can associate the item index
> with the item immediately when you're adding it to the list, not later.
>
> H> This works as long as the image list is not empty when the list itself
> H> is created and filled up.
>
> Yes.
>
> H> But in my case the list is filled up by user interaction. And it can
> H> happen that some items in the list are not associated with an image in
> H> the image list. So, in these cases - without any additional precautions
> H> from my side - it can happen that the program crashes if these items are
> H> entered by the user in the beginning.
>
> It's not a typical use of wxImageList, normally it contains a fixed number
> of images while in your case, AFAIU, its contents is user-defined. So,
> indeed, unusual precautions must be taken.
>
> H> BTW: Is there any possibility to detach the image list again from the
> H> list?
>
> What about calling SetImageList() with a dummy empty image list?
>
> Regards,
> VZ
Hi,
calling SetImageList() with a NULL(!) image list works, so does
AssignImageList. Nevertheless, it is better to have a separate method
that guarantees the intended behaviour. Actually you have to look into
the source code to find out that it works (or it has to be separately
documented).
It is basically the same situation as for the original topic. How should
the user know that a NULL image list works but not an empty one?
I still consider it as a bug that an empty list does not work. An empty
list should be equivalent to a non-existing list.
Hartwig
More information about the wx-users
mailing list