Recent

Author Topic: Conversion from Delphi  (Read 7666 times)

ddahlgren

  • New Member
  • *
  • Posts: 12
Conversion from Delphi
« on: August 15, 2018, 05:05:05 pm »
I am looking for some docs that might outline a list of known things that need to e changed or at least considered to make VCL code compatible or better yet extended properties to enhance. If this means a different component with enhanced function that is fine to. I have done searches and read for hours here before writing this so be gentle LOL.

I have a legacy program that makes extensive use of charts and databases. It needs to be updated for playing well in XP to Win 10 with no cross platform needs currently. If this goes well I have a need for a data analysis program that needs to program the recorder and upload recorded info. Obviously it will be heavy on charting and needs USB comms to connect to the logger and be compatible with the same Win software lever XP..10.

I have downloaded the latest as of yesterday software and wondering what system to do the programming and have a XP laptop that is 100% off the net but has some Delphi software on it that uses the Delphi BDE that I don't want to molest either. Other than that a Vista machine I rather hate but does accounting and that sort of thing and a Win 8 laptop that is on the net endlessly with a rather small screen.

Any and all thoughts are appreciated and quite welcome.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Conversion from Delphi
« Reply #1 on: August 15, 2018, 05:24:43 pm »
Hello ddahlgren,
Welcome to the forum.

Coming from Delphi, read this:
http://wiki.lazarus.freepascal.org/index.php/Lazarus_Documentation#Coming_from_Delphi

How to convert a Delphi projects to Lazarus:
http://wiki.lazarus.freepascal.org/Lazarus_For_Delphi_Users#The_first_thing_to_do_when_converting_a_Delphi_project_to_Lazarus

Lazarus/FPC supported database:
http://wiki.freepascal.org/Databases

List of tutorials with wide range of topics (graphics, database, printer, web, etc):
http://wiki.freepascal.org/Lazarus_Documentation#Lazarus.2FFPC_.28Free_Pascal.29
http://wiki.freepascal.org/Category:Tutorials

(Free) Pascal reference guide:
http://freepascal.org/docs-html/current/ref/ref.html

Lazarus IDE tricks:
http://wiki.freepascal.org/New_IDE_features_since

Default Lazarus installation is bundled with example projects. You can open and study them but you should save them to a new location before running them.
Lazarus main menu > Tools > Example Projects

ddahlgren

  • New Member
  • *
  • Posts: 12
Re: Conversion from Delphi
« Reply #2 on: August 15, 2018, 06:08:15 pm »
Thank you for your generous help you have filled tonight's reading list.  :)

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: Conversion from Delphi
« Reply #3 on: August 15, 2018, 07:16:19 pm »
Well, if you are coming from a Delphi version pre-2009 then simply compile everything in mode delphi...
Specialize a type, not a var.

ddahlgren

  • New Member
  • *
  • Posts: 12
Re: Conversion from Delphi
« Reply #4 on: August 15, 2018, 07:29:54 pm »
Coming from Delphi 5 an oldie LOL I said legacy LOL.
I need to get the program to play nice with later Win versions than Win 2000 and add some much needed enhancements.
Any thoughts on what version of windows to load Lazarus?
Have Win 7 and XP and rather not get involved in Vista given a choice.
Finished software needs to install clean and run well on XP to 10.
Dave

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Conversion from Delphi
« Reply #5 on: August 15, 2018, 07:46:56 pm »
Any thoughts on what version of windows to load Lazarus?
Have Win 7 and XP and rather not get involved in Vista given a choice.
Finished software needs to install clean and run well on XP to 10.
Dave
Your best bet is likely to develop on XP, that way you are sure you don't inadvertently introduce some later operating system dependency in your code.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Conversion from Delphi
« Reply #6 on: August 15, 2018, 08:42:08 pm »
Have Win 7 and XP and rather not get involved in Vista given a choice.
Finished software needs to install clean and run well on XP to 10.

AFAIK, most XP OSes are 32-bit and most Win7 are 64-bit. So if you're developing using Win7 but target to WinXP you need to make sure you configure the settings properly:
Lazarus main menu > Project > Project Options > Compiler Options > Config and Target > set Target OS (-T) to Win32 and Target CPU family (-P) to i386

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: Conversion from Delphi
« Reply #7 on: August 15, 2018, 09:56:33 pm »
Coming from Delphi 5 an oldie LOL I said legacy LOL.
I need to get the program to play nice with later Win versions than Win 2000 and add some much needed enhancements.
Any thoughts on what version of windows to load Lazarus?
Simply recompile the delphi 5 code in {$mode delphi} unless you used third party components.
Also, the Lazarus project converter does a good job. Try that first. Again, unless you used third party components.
If you are stuck and do not use third party components I can fix it in minutes if you attach the sourcecode. Maybe plus two hours for database connectivity.
Lazarus code runs great on any windows post XP.
« Last Edit: August 15, 2018, 09:59:05 pm by Thaddy »
Specialize a type, not a var.

ddahlgren

  • New Member
  • *
  • Posts: 12
Re: Conversion from Delphi
« Reply #8 on: August 15, 2018, 11:06:14 pm »
I need to dig the code off a Win 2K desktop that has not been used in years. The databases involved use the BDE and don't remember it being much of an issue other that well over a decade ago. I found the BDE to be more of a problem than a solution to be honest. I may have used TeeChart and unsure now if it was 3'rd party or not and possibly a third party package to help with resizing all the forms and controls in a sensible way but not so sure it was much of a success. Will load the source files and install Lazarus on the XP laptop and report back in a couple of days.

ddahlgren

  • New Member
  • *
  • Posts: 12
Re: Conversion from Delphi
« Reply #9 on: August 30, 2018, 05:38:45 am »
Well I finally got Lazarus installed and running. While i have not programmed in probably a decade it seems like where I left off and starting to come back pretty quick. I will go though the example code and other info kindly offered to me in this thread. I am going to warm up with making a simple project that is calculation intensive but only needs a few forms and the ability to save and name the input and results and print a one sheet report in some common format possibly better than plain text. I was thinking pdf so it could be locked down and my biz heading could not be easily removed from the report. It will need some charting to and basically I want to concentrate to get the form sizing correctly and add it the compute section when that is all correct. That will give me a chance to concentrate on just the math functions.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Conversion from Delphi
« Reply #10 on: August 30, 2018, 05:58:11 am »
Good to hear you managed to make it works.

You can use Lazarus to create pdf file:
http://wiki.freepascal.org/PowerPDF

You can even export to xls files, see the example here:
https://forum.lazarus.freepascal.org/index.php/topic,42296.msg295110.html#msg295110

For reporting, you can use LazReport or FPReport:
http://wiki.freepascal.org/LazReport_Tutorial
http://wiki.freepascal.org/FPReport

You may want to use TAChart:
http://wiki.lazarus.freepascal.org/TAChart

ddahlgren

  • New Member
  • *
  • Posts: 12
Re: Conversion from Delphi
« Reply #11 on: August 30, 2018, 05:29:51 pm »
As always everyone generous with information here will look at the info provided. With these tips it will allow me me to generate sample reports and charts with dummy data.
That will complete the 'front end' of it and then the compute section.

I want to keep the compute section separate as it may evolve with more or less information and complexity.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Conversion from Delphi
« Reply #12 on: September 01, 2020, 08:29:28 am »
I wonder if there is something like
{$IFDEF Lazarus} or whatever which Delphi will not see?
Some code used in Lazaraus shall be compile in Delphi, but it won't be needed in Delphi.
To make myself clear:

Code: Pascal  [Select][+][-]
  1. Line 1;
  2. Line 2;
  3. Line 3; //This line shall be removed in Delphi, but is needed in Lazarus.
  4. Line 4;


There is:

Code: Pascal  [Select][+][-]
  1. Line 1;
  2. Line 2;
  3.  
  4. {$IFDEF DELPHI_4_OR_HIGHER}
  5.         //DoNothing;
  6. {$ELSE}
  7.         Line 3;
  8. {$ENDIF}
  9. Line 4;
  10.  
   
Lazarus code is executed in the $ELSE section, but I am not sure this is the correct behaviour.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Conversion from Delphi
« Reply #13 on: September 01, 2020, 09:08:55 am »
Use {$ifdef fpc} or {$ifndef fpc} depending on the situation.

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: Conversion from Delphi
« Reply #14 on: September 01, 2020, 09:24:18 am »
BDE code needs changing, indeed, but is usually quite easy to change to SqlDb for SQL based BDE code.
For dBase based BDE you can use TDBF and even for Paradox based BDE code there is a solution.
What is your underlying database format? Then I can probably give you some advice on how to port the code.

Note that even for Delphi BDE is not only legacy but deprecated and not maintained.
Note that if you own a Delphi professional or higher, but pre-delphi 2010, you will have the BDE interface for WIN32 and that can be massaged to work with FPC in the usual way (add {$IFDEF FPC}{$MODE DELPHI}{$ENDIF} I have done that for D7 code on a system with BDE installed.
[edit]
I looked it up and what I actually did a long time ago was this at the program level and unit level, at the top:
Code: Pascal  [Select][+][-]
  1. {$IFDEF FPC}{$MODE DELPHI}{$DEFINE VER150}{$ENDIF}
This mimics Delphi 7 and also works for versioning by commonly used include file. Since compatibility with D7 is close to 100% this can save a lot of time. This define needs to precede the include file or added on top of the include file.
It is still not a guarantee, but works even better than just {$mode delphi} in a lot of cases and it works if you have the sourcecode of the BDE interface units. Note you also need to have a Delphi professional + license to legally use this trick profesionally.
« Last Edit: September 01, 2020, 09:55:11 am by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018