Mattias Gaertner wrote:

Ok I found the problem. Lazarus simply adds the image to the list without making a copy, so when I deleted the image after adding it (like is done in delphi) the image vanished :) . Is this an error?

Sorry for the late response.
There AddCopy and AddDirect methods. At the moment Add calls AddDirect.
Delphi's TImageList uses for historical reasons one image for the whole list
and has therefore no AddDirect. The whole Lazarus code uses AddDirect and
never AddCopy, so it seems Add as AddCopy is a Delphi atavism.
I asked on the devel list if we should change it - no response so far. It's
a difficult decision.
Thanks for the reply. I had already discovered this. The only thing that needs to be done to make it function like Delphi is to make a copy of the bitmap and mask and save the copy in the imagelist. For now, in Lazarus, I am simply not freeing the image after adding it to the list.

Just an interresting fact. I am porting a large program that is still in development to Lazarus. This means that every change I make in order to have it work in Lazarus must also be done in Delphi since until all is done the Delphi version goes to the clients. For this reason I tried to create an Imagelist like Lazarus in Delphi where the list is a simple TList pointing to the bitmaps. And you know what? Delphi can't handle it, at least not on my machine (Win98 with 512MB). I place around 700 small images in the list and Delphi crashes around 400-500. Lazarus has no problem.

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to