Recent

Author Topic: how to force lazarus make project with text DFM, or LFM ?  (Read 3954 times)

alexraynepe196

  • New Member
  • *
  • Posts: 21
how to force lazarus make project with text DFM, or LFM ?
« on: November 20, 2021, 01:17:09 pm »
Hallow! i've imported design-time package from delphi, and try install it in lazarus 2.0.10 with fpc 3.2.0 on win8

when package converting, i marks `Use the same DFM form file`. And now i have generated binary-DFM on package build.

When i try rebuild lazarus with it, have fails:
```
Error: No known file format detected for file 'D:\projects\pascal\TurboPack\systools.hggit\packages\lazarus\lib\x86_64-win64\StAbout0.DFM'
lazarus.pp(165,1) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.
```

i guess, FCP wants text-DFM, or even LFM. How can i force my package to generate text-DFM ?

Bart

  • Hero Member
  • *****
  • Posts: 4689
    • Bart en Mariska's Webstek
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #1 on: November 20, 2021, 01:18:29 pm »
Uncheck `Use the same DFM form file` maybe?

Bart

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9980
  • FPC developer.
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #2 on: November 20, 2021, 04:43:20 pm »
Afaik Lazarus can't generate binary DFM. So probably the Delphi project had some open DFMs.


wp

  • Hero Member
  • *****
  • Posts: 9571
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #3 on: November 20, 2021, 05:14:47 pm »
You can convert a binary dfm to text format by calling menu "Tools" > "Delphi Conversion" > "Convert binary dfm to text lfm + Check Syntax". As the menu caption says this will create a text lfm file, but you can rename it back to dfm.

But normally it is a bad idea to use the same dfm file in both Delphi and Lazarus because each one of them introduces different properties into their file so that the other will not be able to read it without interrupting your workflow.

What you can do is to replace the {$R *.dfm} by
Code: Pascal  [Select][+][-]
  1. {$IFDEF FPC}
  2.   {$R *.lfm}
  3. {$ELSE}
  4.   {$R *.dfm}
  5. {$ENDIF}
This way both Delphi and Lazarus use their own form files.

The disadvantage is that you must keep two files up-to-date this way.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4096
  • I like bugs.
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #4 on: November 20, 2021, 08:01:58 pm »
when package converting, i marks `Use the same DFM form file`. And now i have generated binary-DFM on package build.
...
How can i force my package to generate text-DFM ?
As wp answered, LFM is recommended.
The Delphi converter converts a binary DFM to a text LFM automatically. Maybe a binary DFM is used as-is without conversion. It is such a rare use case that I have not tested it.
Actually binary DFMs are very rare nowadays. They were used only in old Delphi versions. I don't remember exactly when they switched to text format.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

alexraynepe196

  • New Member
  • *
  • Posts: 21
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #5 on: November 21, 2021, 01:24:34 pm »
Thank, got it, and fixed

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9980
  • FPC developer.
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #6 on: November 21, 2021, 04:35:50 pm »
Actually binary DFMs are very rare nowadays. They were used only in old Delphi versions. I don't remember exactly when they switched to text format.

I think D4.

Note that using separate .dfm and .lfm's essentially make the designer impossible for dual use, and thus is an extremists solution.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4096
  • I like bugs.
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #7 on: November 21, 2021, 08:58:41 pm »
Note that using separate .dfm and .lfm's essentially make the designer impossible for dual use, and thus is an extremists solution.
Then you must edit the .dfm with Delphi. Otherwise you would not need Delphi support and a separate .dfm.
I know this is not a very convenient solution but it solves the problem of different component properties between VCL / LCL.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9980
  • FPC developer.
Re: how to force lazarus make project with text DFM, or LFM ?
« Reply #8 on: November 21, 2021, 09:02:12 pm »
I use shared .dfm for multiple applications. It generally works fine.

 

TinyPortal © 2005-2018