Crash Course Lazarus 2 - Conversion from a Delphi project
Lazarus is highly compatible with Delphi. Let's convert an existing Delphi project.
- If you haven't done so already, create a new folder \FPLaz on your harddisk.
- If you haven't done so already, create directory Foot2Meter "under" \FPLaz.
- Download foot2meter.zip (Delphi source code for the project) from the
Downloads section and unzip it to this folder.
Foot-to-Meter: conversion from Delphi
The Lazarus IDE contains a tool for converting Delphi projects. Here is how to use it:
- Start Lazarus.
- If a project is already loaded, in the menu select File / Close All.
- In the menu, select Tools / Delphi Conversion / Convert Delphi Project to Lazarus Project
In the dialog, navigate to \FPLaz\Foot2Meter, select Foot2Meter.dpr and click Open.
- A new dialog is opened. Leave all the options as they are and click Start Conversion.
- The conversion starts. If all went well, you'll see the source code of Unit1 in the Source Editor.
For viewing the main form, in the menu select View / Toggle Form/Unit View (or press function key F12).
- Run the project: menu Run / Run (or press function key F9).
- Your project is compiled: the result is foot2meter.exe.
Immediately after that, the program foot2meter.exe is launched in the "debugger" environment.
- Enter a number in the first edit-box, for example: 5. Also enter a number in the
second edit-box, for example: 9. Click on the button with the caption "Convert". On the right,
you should see the corresponding length in meter.
- Click on the radiobutton "Meter to foot / inch". Note that the 2 components for inches become invisible.
- Stop the program via its menu and Exit, via its sytem menu, or via its Close-button
(top right of the window).
- Stop Lazarus. If you get the question "Save changes to...?", say no. Because maybe you changed something
in the source code and for the moment we don't want to save these changes.
Foot2Meter as a stand-alone program
Open folder \FPLaz\Foot2Meter and you'll see the file Foot2Meter.exe, either in this folder or in
a subfolder lib\i386-win32 (depending on the version).
Double clicking Foot2Meter.exe will start your program as a stand-alone program, this time not in the debugger
Building the project from the ground up
For the rest of this project, we refer to the Delphi version, starting from
Form, Edits, Buttons.
Just follow the directions on those pages, but instead of installing in subfolders of \DelphiLand,
create subfolders of \FPLaz, such as \FPLaz\Foot2MeterSimp.