Recent

Author Topic: Delphi import issue  (Read 1533 times)

Sammy75

  • Newbie
  • Posts: 2
Delphi import issue
« on: September 29, 2019, 09:19:46 pm »
Hi All

As a previous Delphi user I downloaded Lazarus today (lazarus-2.0.4-i686-macosx.dmg) and tried import a couple of previous Delphi projects.  The programs seem to convert ok but when run the application form is drawn but 'freezes' - ie you can't use edit controls, click buttons etc. 

I thought it could be something specific about the projects I had created so I then got Foot2meter from http://www.festra.com/fp/les02.htm and tried again....and it froze in the same way. 

I'm sure its me doing something daft - I hope someone can tell me what? 

Thanks in advance

Sam

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Delphi import issue
« Reply #1 on: September 29, 2019, 09:33:35 pm »
Does a simple app from the IDE work?
The only true wisdom is knowing you know nothing

Sammy75

  • Newbie
  • Posts: 2
Re: Delphi import issue
« Reply #2 on: September 29, 2019, 11:31:06 pm »
Hi - yes, I can create a basic form with a button and a popup or whatever and it works fine

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Delphi import issue
« Reply #3 on: September 29, 2019, 11:52:05 pm »
So I take it that it must be failing during the startup of your converted app from the old Delphi sources ?

 Maybe a control you were using in Delphi does not exist or some property?
 
 You can open the *.lfm file to examine the content to see if you see something that does not look correct for initializing the properties of the forms and controls during startup.

 For example, a control in the script that you know isn't in Lazarus etc..
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Delphi import issue
« Reply #4 on: September 30, 2019, 12:21:59 am »
I downloaded the foot2meter project and converted it using the Delphi project converter as described in the article, and the converted program compiles and runs fine here.

I also tried manual conversion, no issues either. These are the steps for manual conversion:
  • Open the dpr file in an external editor, add "Interfaces" as first unit to the "uses" clauses. Save the modified dpr file with extension lpr.
  • Normally rename the dfm file to lfm. But here the dfm file is in the old binary format which nobody uses today any more. You can convert this in Lazarus, menu "Tools" > "Delphi conversion" > "Convert binary DFM to text LFM"; this automatically creates the lfm file.
  • Open the pas file in an external editor. Find the line {$R *.DFM}, and change it to {$R *.lfm}
  • Load the lpr file into Lazarus. Select "Project" > "Application" when you are prompted to create a new project. Then, in menu "Project" > "Project Inspector", click "Add" > "Add files from file system" and select the pas file to add it to the project.
  • Finished. The project now should compile.
You seem to be on a Mac, I am on Windows. If it still does not work there might be some Mac-specific issue, but I don't believe this -- it is such a simple project.

One observation, though: the project, like many old Delphi projects uses a hard-coded Windows font "MS Sans Serif". Maybe the Mac chokes on that? You can fix this when you select the form in the Object Inspector, go to property Font and enter "default" as font name and "0" as font size (all unquoted).

In the attachment there is a converted foot2meter which is working for me.
« Last Edit: September 30, 2019, 09:55:20 am by wp »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Delphi import issue
« Reply #5 on: September 30, 2019, 07:04:47 am »
Indeed, the important step is to convert the binary dfm to text first, then convert the project.
Project also works on Raspbian
Specialize a type, not a var.

 

TinyPortal © 2005-2018