Installation, the IDE and First Programs

Shortcuts: F9 run, Ctrl+F9 compile, Shift+F9 build, F7/F8 step into/over, F5 breakpoint, Ctrl+Shift+C class completion, Ctrl+Shift+↑/↓ jump between declaration and implementation, Ctrl+Click go to definition, Ctrl+J templates, Alt+Shift+R refactor rename.

2.1 Installing

Download Delphi Community Edition (or a trial) from embarcadero.com and register for a license.

Choose platforms (Windows 32/64, Android, iOS, macOS, Linux) and features (help, samples, Skia, GetIt packages).

Optional for mobile: Android SDK/NDK (installer-managed), and a Mac with Xcode plus the PAServer (Platform Assistant Server) for iOS/macOS.

2.2 The IDE Tour

Welcome Page Recent projects, GetIt, news Form Designer

Visual layout of VCL/FMX forms (F12 toggles code/design) Code Editor

Syntax highlighting, Code Insight (Ctrl+Space), Code Completion, Class Completion (Ctrl+Shift+C) Tool Palette Components to drop on forms Object Inspector

Properties and Events of the selected component (F11) Structure View Component tree / code structure Projects Window

Project groups, build configurations, target platforms Compiler hints, warnings, errors GetIt Package Manager Install libraries and components Debugger windows

Watches, Locals, Call Stack, CPU, Threads, Breakpoints Shortcuts: F9 run, Ctrl+F9 compile, Shift+F9 build, F7/F8 step into/over, F5 breakpoint, Ctrl+Shift+C class completion, Ctrl+Shift+↑/↓ jump between declaration and implementation, Ctrl+Click go to definition, Ctrl+J templates, Alt+Shift+R refactor rename.

2.3 First Console Program

File → New → Console Application – Delphi. Run with F9.

program HelloDelphi;

{$APPTYPE CONSOLE}

uses
  System.SysUtils;

var
  Name: string;
begin
  try
    Writeln('Hello, Delphi!');
    Write('What is your name? ');
    Readln(Name);
    Writeln('Nice to meet you, ', Name, '!');
    Writeln(Format('Today is %s', [DateToStr(Date)]));
    Readln;                       // keep the console open
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

2.4 First VCL Program

File → New → Windows VCL Application – Delphi. Drop a TButton, TEdit, and TLabel on the form.

Double-click the button to create an OnClick handler:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := 'Hello, ' + Edit1.Text + '!';
  ShowMessage('Button clicked');
end;

2.5 Project Files

Program (project) source: the main entry point MSBuild project settings Unit source code .dfm / .fmx

VCL / FMX form definition (text or binary) Resources (icon, version info) .dpk / .bpl / .dcp

Package source / runtime package / package symbol file .exe / .dll / .so / .apk / .ipa / .app