ImageList in in form not compatible beween lazarus and Delphi - anyone confirm? lazarus / 31-LCL ---------------------------------------------------------------------- MISV · 2014-09-24 19:24 I have a peculiar problem. If I open a dfm form in Lazarus (Windows 1.2.4) I can view images in the imagelist. But if I save it and reopen the form in Delphi, the imagelist is cleared in Delphi. Seeing that there otherwise is near perfect compability, it would be nice if this got fixed. I could not find this issue in the bug tracker? if anyone can confirm what I am seeing, I will submit it as a bug ---------------------------------------------------------------------- Blaazen · 2014-09-24 19:56 I can only say that Delphi7 supports *.bmp and *.ico files (no idea about transparency) while Lazarus supports *.png files. How do you save *.dfm file in Lazarus? ---------------------------------------------------------------------- MISV · 2014-09-24 20:30 I have not touched any settings. Using Lazarus defaults. I basicly have a project where a .pas file has a .dfm resource I simply switched from .pas to form view in Lazarus and then saved it. Then going back to Delphi 2007, the imagelist comes up empy (probably because it can not read the images) ---------------------------------------------------------------------- derek.john.evans · 2014-09-28 17:01 Same here with Delphi 7 Pro. But, the code to save a TImageList doesn't look like it is even trying to be compatible with Delphi.  From: imglist.pp Line: 1069 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TCustomImageList.WriteData(AStream: TStream);var  Signature: TImageListSignature;begin  //Write signature  Signature:=SIG_LAZ3;  AStream.Write(Signature,SizeOf(Signature));   //Count of image  WriteLRSInteger(AStream,Count);  WriteLRSInteger(AStream,Width);  WriteLRSInteger(AStream,Height);   //images  if Count > 0 then    AStream.Write(FData[0], FWidth * FHeight * FCount * SizeOf(FData[0]));end;   SIG_LAZ3 = 'Li' which is what I see being saved to the new dfm file. ie: $4C69 I guess, you can ask for a SIG_D3 TImageList stream saver, which would be used when saving to dfm files. ---------------------------------------------------------------------- MISV · 2014-11-11 14:47 I would be very interested in investigating this further since I think it is pretty vital for those compiling in both Lazarus and Delphi using the same form files I guess overriding *WriteData* could be a way. But I think the code should be in the same unit as the reader which can handle Delphi. Then maybe be a property that could be set when loading/saving .dfm files? ---------------------------------------------------------------------- MISV · 2014-11-14 14:42 Do you think there would there be interest in this? If I or anyone else did this: When imagelist read data: If it detects Delphi format, it sets a property. Then it saves the imagelist again, it uses this property to know it has to save in Delphi mode. The code to save imagelists in Delphi compatible format would then be added. Or would such a fix/addition not be accepted? Just trying to gauge if I should persue this further ---------------------------------------------------------------------- MISV · 2014-11-25 11:23 I can see the source appears changed in 1.2.6 (?)  fossies.org/dox/lazarus-1.2.6-0/imglist_8inc_source.html I will try i out soon and report back ---------------------------------------------------------------------- MISV · 2015-01-20 02:45 Unfortunately it is not corrected in 1.2.6 I have now created a TMyImageList which override read data and write data functions... If imagelist is Delphi upon load, a variable is set to remember that we want to save imagelist in Delphi format as well. (This component is written in a way, so it can be installed into both Delphi and Lazarus to maintain form compability.) However, I have yet to convert the code that reads Delphi imagelists to store imagelists in Delphi formats Code: [Select]if Signature = SIG_D3     then begin       AStream.ReadWord; //Skip ?       NewCount := ReadLRSWord(AStream);       //DebugLn('NewCount=',NewCount);       AStream.ReadWord; //Skip Capacity       ...     from imglist.pas in FPC/Lazarus directory (Overall, i is important for me to maintain as much form compability as possible, so I do not have to design the same forms in multiple tools. I rather have a more basic GUI in form files and then handle rest in code through various ways. Still, most of my ratther complex GUI works okay in Lazarus, so Lazarus is very close to perfect - just things like the imagelists that ruin it a little for my x-tool/x-platform dream.) ---------------------------------------------------------------------- MISV · 2015-05-05 18:28 I have posted my code here: http://forum.lazarus.freepascal.org/index.php?topic=28316 (with further explanation on how one can also have side-by-side Lazarus and Delphi working on the same form files + my current code where I *try* to stream/save back imagelist content in a Delphi compatible way)