Intro to Event-driven Programming
and Forms with Delphi
L01 - Introduction
Intro to Event-driven Programming and Forms with Delphi
2010, 2011, 2012
About the Course
How to think like a programmer
You need to try your self, otherwise it won’t work out with
you (practice, practice, practice)
Introduction to Delphi
Introduction to IDE & Event Driven Programming
StartSaveOpen a project
Form design (designruntime )
Drawing (Canvas, Timer, etc.)
Instantiate Controls at Runtime
‘ALGOL’* the first high-level language
‘ALGOL’* > Pascal ‘Niklaus Wirth’**
the original definition of Pascal was published in 1971.
Pascal becomes the ‘FORMAL’ programming language.
Turbo Pascal 1.0 (November 1983)
Delphi in 1995 Was introduced for ‘Visual Programming’
• *ALGOL: Algorithmic language
• ** Niklaus Wirth: (b. February 15, 1934) is a Swiss computer scientist, best
known for designing Pascal programming language, and for pioneering
several classic topics in software engineering. In 1984 he won the Turing
Award for developing a sequence of innovative computer languages.
• Interface: from “Console” to “Visual”.
• All Applications need Visual Interaction.
• IDE: (Integrated Development Environment)
Delphi Preferences & features
OOP (Object Oriented Programming)
Applications: are build in the form of ‘forms’.
Api functions ‘in Windows’.
10 times faster compiler in comparison to other programming
– Executive building files (exe) forms.
– No DLL libraries like other programming languages (Dynamic Link
– Database compatibility.
• New > VCL forms Applications
OpenSave a Project
• When saved.
– first, “UNIT” is being saved
– Then, the “PROJECT”
• File > Save as
(Pas file is saved)
• File > Save project as
(dpr is saved)
• “exe.” file is formed in running time.
Windows Applications forms
Every “form” has a corresponding “unit”
• All the following properties are ‘boolean’s:
• All three buttons disappear.
• to taskbar minimization.
• resize button.
• ’?’ button.
• Position: the place the form will appear on the screen.
• Icon: the style of the form’s icon.
– You can browse it from your PC images & pics.
• Name: the one we use in code (we can’t write in Arabic here.)
• Caption: the “Visual” name that will appear to the client. (we can
write in Arabic here) *
• Topleft: parametric variables indicate the position of the
component in the form.
• Fonts: colorvolume & type of the written “Caption” design.
• Hint: showing a ‘hint’ when the cursor (mouse) stop on the ‘button’.
• Show Hint: shows the written hint above.
• Visible Enabled
• Tab Order
*Delphi is Arabic compatible
• The name of the application's executable file appears as the
“caption” of the message box.
• Msg parameter is the message string that appears in the
• Code example:
If (not(Worked)) then
procedure TForm1.Button1Click(Sender: TObject);
var b: boolean;
if (not(b)) then
ShowMessage('Hi There ');