Andreas Berger wrote:

I am porting an application from Delphi that depends heavily on images added at runtime to a TImageList. However, the Add method does not seem to work in Lazarus. Here is an example:

   normalImages := TImageList.Create(AOwner);
   normalImages.Height := 33;
   normalImages.Width := 33;
   normalImages.Masked := false;
   . . .
   image := TBitmap.Create;
   image.LoadFromFile(f);
   currImages.Add(image, Nil);
   . . .
normalImages.GetBitmap(baseImage * uc_NumOptions + imageIndex, image.Picture.Bitmap); // This copies nothing into image

It also does not work if I place a TImageList on a form and add the images (as above) at runtime. However, if I place a TImageList on the form and store the images into it via the object inspector then the above line works ok. I assume that the Add function does not work correctly.

Andreas

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?

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

Reply via email to