Recent

Author Topic: Delphi Forms  (Read 5715 times)

Degibbo

  • New Member
  • *
  • Posts: 46
Delphi Forms
« on: July 21, 2017, 02:20:39 am »
G'day all,
Total newby here, just downloaded Lazarus yesterday, so please be kind.

I have a Delphi 2010 project that I need to modify with Lazarus, but the
forms files are binary, not text so don't show as visual forms with components.

Is there a simple way to get around this?

Cheers & thanks,
DG

PS, please advise if I am posting in the wrong area.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Delphi Forms
« Reply #1 on: July 21, 2017, 02:24:57 am »
Hi and welcome Degibbo,

Wiki entry on Delphi converter can be read here.

The converter can sometimes be a miss though. There are several threads available on the subject, so feel free to do a search or mention in case you run into problems.

Lazarus for Delphi users wiki entry (here) might be able to help you out as well.
« Last Edit: July 21, 2017, 02:27:44 am by molly »

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Delphi Forms
« Reply #2 on: July 21, 2017, 06:12:22 am »
G'day Molly,
Thanks for the tips.  The conversions seem to work, but it looks
like each has to be converted individually, so a bit tiresome with
the 60 units and 60 forms that I have to convert!

The converter appears to turn binary forms into text, but I still
can't get forms to show as a form individually, (F12 is grayed out)
so I must be doing something wrong!

Any quick hints?
Thanks,
DG

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Delphi Forms
« Reply #3 on: July 21, 2017, 08:55:18 am »
Thanks for the tips.  The conversions seem to work, but it looks
like each has to be converted individually, so a bit tiresome with
the 60 units and 60 forms that I have to convert!
It can convert a whole project or package.

Quote
The converter appears to turn binary forms into text, but I still
can't get forms to show as a form individually, (F12 is grayed out)
so I must be doing something wrong!
With the textual .lfm file you should be able to show the form as all its information is stored in the .lfm.
Can you attach problematic unit + form files here?

I think your project is very old. Delphi used binary forms only in the early versions.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Delphi Forms
« Reply #4 on: July 21, 2017, 09:10:24 am »
G'day JuhaManninen,
OK, if I convert a "project" file it does not appear to trickle down
through all of the used units and forms, so I must be doing it wrong.

For example: if I convert one particular DFM file I get a "syntax error",
but it doesn't appear to show me where (and what) the error is!
It probably can, but I don't know how.

I am sure that these are problems from my ignorance, and yes, the
20,000 odd lines of code program is very old, as am I.  So far, I have
not found Lazarus very "intuitive", but I am sure it is just me.

Probably fantastic for an experienced user (my last programming was
over 10 years ago).  So, I have a lot to re-learn, and unfortunately I
require step by step instructions.

Cheers & thanks,
DG

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Delphi Forms
« Reply #5 on: July 21, 2017, 12:14:08 pm »
I am sure that these are problems from my ignorance, and yes, the
20,000 odd lines of code program is very old, as am I.  So far, I have
not found Lazarus very "intuitive", but I am sure it is just me.

Binary DFMs have been deprecated since Delphi 4 in 1998 and are mostly extinct. (near 20 years of technical debt in that project). Lazarus is only gaining as highly compatible Delphi substitute since the 2005-2007 period, and these two facts combined is  s probably why nobody worked on a newer version (either developer or external contributor).  The related need for an old Delphi version to test with might also be prohibitive.


WooBean

  • Full Member
  • ***
  • Posts: 229
Re: Delphi Forms
« Reply #6 on: July 21, 2017, 01:14:58 pm »
I have found an utility named DFMConverter which states in its "About window": "This DFM converter was developed by HREF Tools Corp., July-August 2006.  You may distribute it freely to your friends and colleagues."
Dowloaded from Embarcadero, not tested as never needed. It has an ability of 2-way binary/text DFM Delphi files conversion.
Platforms: Win7/64, Linux Mint Ulyssa/64

ASerge

  • Hero Member
  • *****
  • Posts: 2212
Re: Delphi Forms
« Reply #7 on: July 22, 2017, 06:59:48 am »
Binary DFMs have been deprecated since Delphi 4 in 1998 and are mostly extinct. (near 20 years of technical debt in that project).
Yes, starting from the specified version, Delphi contains the option "New forms as Text" in the settings (Form Designer), which is enabled by default.
Also all versions of Delphi contain the utility "convert.exe", which converts between text and binary forms.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Delphi Forms
« Reply #8 on: July 22, 2017, 08:23:42 am »
OK, if I convert a "project" file it does not appear to trickle down
through all of the used units and forms, so I must be doing it wrong.
Ok, maybe it does not recognize the units as part of the project. You have 2 choises then:
1. Add them to the project in Delphi before converting.
2. Select all units at once when using the "Convert Delphi Unit to Lazarus unit ..." feature. The file open dialog has multi-select enabled.

Quote
For example: if I convert one particular DFM file I get a "syntax error",
but it doesn't appear to show me where (and what) the error is!
It does not handle all error situations well. Can you attach the problematic unit for testing?

Quote
I am sure that these are problems from my ignorance, and yes, the
20,000 odd lines of code program is very old, as am I.
People suggested other tools for converting binary form files but the converter can do that piece perfectly well. No need for other tools for that.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Delphi Forms
« Reply #9 on: July 24, 2017, 05:53:02 am »
Thanks for the help everyone.  I have now managed to compile the project with no errors.
However there is still a couple of forms that don't show.  In order to get the project compiled,
there was a lot of stuff that I had to comment out, which I will address later.

With the "main" form, from the dot pas file, F12 produces the error message: (Wrong token type.
Symbol expected but { found (at 3339,2,stream offset 147377)).  Now this is clearly due to one
of my comment-outs, but how do I show where in the code from this magical number?
Some previous errors have shown the first number as the unit line and character position, but
this main unit only has 2000 odd lines!

Cheers & thanks for the continuing support.
DG

 

TinyPortal © 2005-2018