I write a class named TPictureSet which administrates a list of TBitmap-objects.(Fitem)..
But at adding a TBitmap-Object to the list this problem occur :
I can’t store the TBitmap-Object‘s data into the new list item.
function TPictureSet.add(Picture : TBitmap):boolean;
begin
New(PItem); //reserve memory for a new list entry.
// PItem is a pointer on a TBitmap-object.
// type PBitmap = ^TBitmap end;
// PItem : PBitmap ;
PItem^ := Picture; // Here is the problem !!!!!
// Picture seems to be just a pointer !
// so just a pointer is added to the list. and
//all the other data like Bitmap,Palette,Width.and so on.....are lost.
Errormsg.Add('Pictures size is:' +inttostr(SizeOf(Picture)));
Errormsg.Add('PItem s Size is: '+inttostr(SizeOf(PItem^)));
//Errormsg is a StringList which I use for debugging.
//Both sizes (Picture and Pitem^) are 4 bytes.
//So I came to the conclusion that Picture is a pointer.
if FItems.Add(PItem) <> -1 then
//Fitems is a TList-Object
begin
Frames := Frames +1;
Seek := Seek+1;
result := true;
end
else
begin
FErrormsg.add(ImageListName+': '+'Cant append item on ImageList');
result := false;
end;
end;
How can I solve this problem ?
Thank you all for your answers.