Free Pascal
LAZARUS

Crash Course Lazarus 2 - Conversion from a Delphi project

Lazarus is highly compatible with Delphi. Let's convert an existing Delphi project.

Preparations

  1. If you haven't done so already, create a new folder \FPLaz on your harddisk.
  2. If you haven't done so already, create directory Foot2Meter "under" \FPLaz.
  3. 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:

  1. Start Lazarus.
  2. If a project is already loaded, in the menu select File / Close All.
  3. 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.
  4. A new dialog is opened. Leave all the options as they are and click Start Conversion.
  5. 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).
  6. Run the project: menu Run / Run (or press function key F9).
  7. Your project is compiled: the result is foot2meter.exe. Immediately after that, the program foot2meter.exe is launched in the "debugger" environment.
  8. 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.

    Foot2Meter
  9. Click on the radiobutton "Meter to foot / inch". Note that the 2 components for inches become invisible.
  10. Stop the program via its menu and Exit, via its sytem menu, or via its Close-button (top right of the window).
  11. 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 environment.


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.

Enjoy!