Embarcadero Delphi Introduction

From WikiOD

Remarks[edit | edit source]

Delphi is a general-purpose language based on an Object Pascal dialect with its roots coming from Borland Turbo Pascal. It comes with its own IDE designed to support rapid application development (RAD).

It allows cross-platform native (compiled) application development from a single code base. Currently supported platforms are Windows, OSX, iOS and Android.

It comes with two visual frameworks:

  • VCL: Visual Component Library specifically designed for Windows development wrapping Windows native controls and support for creating custom ones.
  • FMX: FireMonkey cross-platform framework for all supported platforms

Versions[edit | edit source]

Version Numeric version Product name Release date
1 1.0 Borland Delphi 1995-02-14
2 2.0 Borland Delphi 2 1996-02-10
3 3.0 Borland Delphi 3 1997-08-05
4 4.0 Borland Delphi 4 1998-07-17
5 5.0 Borland Delphi 5 1999-08-10
6 6.0 Borland Delphi 6 2001-05-21
7 7.0 Borland Delphi 7 2002-08-09
8 8.0 Borland Delphi 8 for .NET 2003-12-22
2005 9.0 Borland Delphi 2005 2004-10-12
2006 10.0 Borland Delphi 2006 2005-11-23
2007 11.0 CodeGear Delphi 2007 2007-03-16
2009 12.0 CodeGear Delphi 2009 2008-08-25
2010 14.0 Embarcadero RAD Studio 2010 2009-08-15
XE 15.0 Embarcadero RAD Studio XE 2010-08-30
XE2 16.0 Embarcadero RAD Studio XE2 2011-09-02
XE3 17.0 Embarcadero RAD Studio XE3 2012-09-03
XE4 18.0 Embarcadero RAD Studio XE4 2013-04-22
XE5 19.0 Embarcadero RAD Studio XE5 2013-09-11
XE6 20.0 Embarcadero RAD Studio XE6 2014-04-15
XE7 21.0 Embarcadero RAD Studio XE7 2014-09-02
XE8 22.0 Embarcadero RAD Studio XE8 2015-04-07
10 Seattle 23.0 Embarcadero RAD Studio 10 Seattle 2015-08-31
10.1 Berlin 24.0 Embarcadero RAD Studio 10.1 Berlin 2016-04-20
10.2 Tokyo 25.0 Embarcadero RAD Studio 10.2 Tokyo 2017-03-22

Hello World[edit | edit source]

This program, saved to a file named HelloWorld.dpr, compiles to a console application that prints "Hello World" to the console:

program HelloWorld;

{$APPTYPE CONSOLE}

begin
  WriteLn('Hello World');
end.

Show 'Hello World' using the VCL[edit | edit source]

This progam uses VCL, the default UI components library of Delphi, to print "Hello World" into a message box. The VCL wrapps most of the commonly used WinAPI components. This way, they can be used much easier, e.g. without the need to work with Window Handles.

To include a dependency (like Vcl.Dialogs in this case), add the uses block including a comma-separated list of units ending with an semicolon.

program HelloWindows;

uses
  Vcl.Dialogs;

begin
  ShowMessage('Hello Windows');
end.

Cross-platform Hello World using FireMonkey[edit | edit source]

XE2

program CrossPlatformHelloWorld;

uses
  FMX.Dialogs;

{$R *.res}

begin
  ShowMessage('Hello world!');
end.

Most of the Delphi supported platforms (Win32/Win64/OSX32/Android32/iOS32/iOS64) also support a console so the WriteLn example fits them well.

For the platforms that require a GUI (any iOS device and some Android devices), the above FireMonkey example works well.

Show 'Hello World' Using WinAPI MessageBox[edit | edit source]

This program uses the Windows API (WinAPI) to print "Hello World" into a message box.

To include a dependency (like Windows in this case), add the uses block including a comma-separated list of units ending with an semicolon.

program HelloWorld;

uses
  Windows;

begin
  MessageBox(0, 'Hello World!', 'Hello World!', 0);
end.

Credit:Stack_Overflow_Documentation