Recent

Author Topic: Sharing the same dfm with Delphi almost works, some minor clarification  (Read 216 times)

maxerist

  • New Member
  • *
  • Posts: 12
I'm very impressed how flexible FreePascal/Lazarus almost in every respect. There was a time when I tried but ultimately failed to reuse the same dfm files between Delphi and Lazarus. Now it almost works, the same file is used by Delphi and two instances of Lazarus, from the Windows and from the Linux guest, no copying needed. Two techniques helped, only I need some clarification on the second one.

* For properties that are not compatible with Lazarus one can use lresources.PropertiesToSkip object and register properties to avoid. This allowed be for example to substitute some TRichEdit ancestor and skip properties like HideSelection not existing in TMemo.

* Encoding conversion for design-time non-ascii strings inside forms. I noticed that the Lazarus copies the dfm files into project output directory so I wrote a little console program that scans the directory and finds dfm forms without BOM marker. For such forms the program converts all strings to utf-8 encoding and saves them with the BOM marker. Lazarus don't care for BOM marker so I gladly used this as a quick indicator for conversion necessity. This program is set up to run with the Project Options - Compiler Options - Compiler Commands and the output of this console program is automatically piped by Lazarus to the messages window, this was also very impressive.

And here I would like a little help in determining what the stage is the best to set up it. I hoped that "Execute after Compile", but at least on one occasion the form was converted (I saw the output during compiling), but the project had a non-converted copy inside the executable after that. So is there a stage when the actual form is copied for sure, but the project didn't yet grab the copies of forms for linking?

Thanks.
« Last Edit: October 06, 2022, 04:54:14 pm by maxerist »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10399
  • FPC developer.
Re: Sharing the same dfm with Delphi almost works, some minor clarification
« Reply #1 on: October 06, 2022, 05:06:31 pm »
I played a bit this summer too, and somehow while it initially goes well and Lazarus uses .dfms, sometimes it generates parallel .lfms and starts using those.

 

TinyPortal © 2005-2018