SlideShare a Scribd company logo
Intro to Event-driven Programming
and Forms with Delphi
L01 - Introduction

Mohammad Shaker
mohammadshakergtr.wordpress.com
Intro to Event-driven Programming and Forms with Delphi
@ZGTRShaker
2010, 2011, 2012
Delphi L01 Intro
About the Course
•
•
•
•

Delphi 2007-2009
How to think like a programmer
Test Questions
You need to try your self, otherwise it won’t work out with
you (practice, practice, practice)
Course plan
•
•
•
•
•
•
•
•
•
•

Introduction to Delphi
Introduction to IDE & Event Driven Programming
StartSaveOpen a project
Form design (designruntime )
Delphi Components
Input Handling
Event handling
Files
Drawing (Canvas, Timer, etc.)
Instantiate Controls at Runtime
Delphi History
•
•
•
•
•
•

‘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.
Delphi History
• Pascal > Delphi
• Borland > Pascal > Compiler > Delphi
Differences
• 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’.
Components
Api functions ‘in Windows’.
10 times faster compiler in comparison to other programming
languages.
– Executive building files (exe) forms.
– No DLL libraries like other programming languages (Dynamic Link
Library)
– Database compatibility.
Now, let’s sneak peek
Install
CodeGear Delphi
What’s for today?
•
•
•
•
•

Design timeExecution time (runtime)
Event-Driven Programming
Your first Project
Forms, Buttons
ShowMessage
Design timeExecuting time
Programs executing
• Procedural Programming:
– Sequential

• “Event-Driven” Programming:
– Event
File Menu
• New > VCL forms Applications
• open
• Save
Delphi L01 Intro
Delphi L01 Intro
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.
Delphi L01 Intro
Object inspector
Object inspector
• Properties: like width, color, etc.
• Events: like pressing buttons, moving mouse, etc.
Properties
Events
Common Properties for all components
•
•
•
•
•
•
•

Width, Height.
Top, left.
‘Hint’ adding & showhint.
Visible.
Enabled.
Font.
Color.
Common Events for all components
•
•
•
•
•
•
•

Onclick
OnDoubleClick
OnMouseMove
OnDragDrop
OnCreate
OnClose
Rest of them
Note that
• All the above properties & events can be modified at design
time or runtime.
Event Handling
Live Example
Tool palette.. components
Tabs
Forms
Windows Applications  forms
Every “form” has a corresponding “unit”
Forms properties
• All the following properties are ‘boolean’s:
– BiSystemMenu:
• All three buttons disappear.

– BiMinimize:
• to taskbar minimization.

– BiMaximize:
• resize button.

– BiHelp:
• ’?’ 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.
Forms events
•
•
•
•
•
•

OnClose
OnMouseClick
OnHold
OnCreate
OnResize
OnMouseWheelUp
Buttons
• Adding a button to our project
Button properties
• 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
• etc.
_________________________________
*Delphi is Arabic compatible
Button Events
•
•
•
•

OnClick
OnMouseMove
OnKeyPress
etc.
Button Events
•
•
•
•
•
•

Let’s have a quick sneak on the code
Create a new form
Place a “Button” named “KeKe” in it.:D
Double click on the button
See where you are now
Test it
ShowMessage
Ctrl + Space
Button Events

Events + Properties
Delphi L01 Intro
Delphi L01 Intro
Test it

Before Clicking

After Clicking
ShowMessage
• 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
message box.
• Code example:
Var worked:boolean;
If (not(Worked)) then
ShowMessage (‘Cmon

Work ’);
Delphi L01 Intro
ShowMessage
procedure TForm1.Button1Click(Sender: TObject);
var b: boolean;
begin
b:= false;
if (not(b)) then
begin
ShowMessage('Hi There ');
end;
end;
ShowMessage

After clicking the button
References
• ‘Delphi’ Help
• Delphibasics.co.uk
• Delphi Books
See you!

More Related Content

PDF
XNA L01–Introduction
PPTX
Lessons Learned with Unity and WebGL
PDF
Playground 11022017 user_monitoring
PPTX
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
PDF
Game Programming - Cloud Development
PPTX
Heroes of Paragon: publishing Unity WebGL game on Facebook
PPTX
Utilizing the OpenNTF Domino API
PPTX
Introduction to development of multiplayer HTML5 games (with Socket.io)
XNA L01–Introduction
Lessons Learned with Unity and WebGL
Playground 11022017 user_monitoring
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
Game Programming - Cloud Development
Heroes of Paragon: publishing Unity WebGL game on Facebook
Utilizing the OpenNTF Domino API
Introduction to development of multiplayer HTML5 games (with Socket.io)

What's hot (20)

PPTX
East Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
PPTX
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
PPTX
Getting Started With PowerShell Scripting
PDF
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
PPTX
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
PDF
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
PDF
Manage your infrastructure with PowerShell
PPTX
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
PPTX
Introduction to Phoenix Framework (Elixir) 2016-01-07
PDF
Functional Programming for Busy Object Oriented Programmers
PDF
Deliver Python Apps with Docker
PPTX
Ndc2017
PPTX
Obfuscating The Empire
PPTX
Top 10 PowerShell Features in Server 2012
PDF
UNM Tech Day 2018 - Ansible: 
Server and Network Device Automation
PDF
Paint it blue with PowerShell
PPTX
Working Well Together: How to Keep High-end Game Development Teams Productive
PDF
Confrontation Pipeline and SCons
PDF
App::RemoteCommand
East Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
Getting Started With PowerShell Scripting
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
Etiene Dalcol - Web development with Lua Programming Language - code.talks 2015
Manage your infrastructure with PowerShell
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
Introduction to Phoenix Framework (Elixir) 2016-01-07
Functional Programming for Busy Object Oriented Programmers
Deliver Python Apps with Docker
Ndc2017
Obfuscating The Empire
Top 10 PowerShell Features in Server 2012
UNM Tech Day 2018 - Ansible: 
Server and Network Device Automation
Paint it blue with PowerShell
Working Well Together: How to Keep High-end Game Development Teams Productive
Confrontation Pipeline and SCons
App::RemoteCommand
Ad

Similar to Delphi L01 Intro (20)

PDF
Delphi L03 Forms and Input
PDF
Unit IV-Checkboxes and Radio Buttons in VB.Net in VB.NET
PDF
Delphi L08 Controls at Runtime P2
PDF
Creating a text editor in delphi, a tutorial
PPTX
INTRODUCTION-TO-VB (2)-PROJECT POWERPOINT.pptx
PPTX
INTRODUCTION-TO-VB (1).pptx introduction
PDF
Ch02 bronson
PPT
VB6_INTRODUCTION.ppt
PPT
VB Dot net
PPT
Introduction to programming using Visual Basic 6
PDF
Visual Basic Tutorials
PPTX
PPT
Advanced Programming Language(Visual basics) .ppt
PPT
Visual basic ppt for tutorials computer
PPTX
01 Database Management (re-uploaded)
PDF
Ppt on visual basics
PPTX
Chapter 1
DOCX
Visual basic concepts
PPTX
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
PPT
Visual studio.net
Delphi L03 Forms and Input
Unit IV-Checkboxes and Radio Buttons in VB.Net in VB.NET
Delphi L08 Controls at Runtime P2
Creating a text editor in delphi, a tutorial
INTRODUCTION-TO-VB (2)-PROJECT POWERPOINT.pptx
INTRODUCTION-TO-VB (1).pptx introduction
Ch02 bronson
VB6_INTRODUCTION.ppt
VB Dot net
Introduction to programming using Visual Basic 6
Visual Basic Tutorials
Advanced Programming Language(Visual basics) .ppt
Visual basic ppt for tutorials computer
01 Database Management (re-uploaded)
Ppt on visual basics
Chapter 1
Visual basic concepts
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
Visual studio.net
Ad

More from Mohammad Shaker (20)

PDF
12 Rules You Should to Know as a Syrian Graduate
PDF
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
PDF
Interaction Design L06 - Tricks with Psychology
PDF
Short, Matters, Love - Passioneers Event 2015
PDF
Unity L01 - Game Development
PDF
Android L07 - Touch, Screen and Wearables
PDF
Interaction Design L03 - Color
PDF
Interaction Design L05 - Typography
PDF
Interaction Design L04 - Materialise and Coupling
PDF
Android L05 - Storage
PDF
Android L04 - Notifications and Threading
PDF
Android L09 - Windows Phone and iOS
PDF
Interaction Design L01 - Mobile Constraints
PDF
Interaction Design L02 - Pragnanz and Grids
PDF
Android L10 - Stores and Gaming
PDF
Android L06 - Cloud / Parse
PDF
Android L08 - Google Maps and Utilities
PDF
Android L03 - Styles and Themes
PDF
Android L02 - Activities and Adapters
PDF
Android L01 - Warm Up
12 Rules You Should to Know as a Syrian Graduate
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Interaction Design L06 - Tricks with Psychology
Short, Matters, Love - Passioneers Event 2015
Unity L01 - Game Development
Android L07 - Touch, Screen and Wearables
Interaction Design L03 - Color
Interaction Design L05 - Typography
Interaction Design L04 - Materialise and Coupling
Android L05 - Storage
Android L04 - Notifications and Threading
Android L09 - Windows Phone and iOS
Interaction Design L01 - Mobile Constraints
Interaction Design L02 - Pragnanz and Grids
Android L10 - Stores and Gaming
Android L06 - Cloud / Parse
Android L08 - Google Maps and Utilities
Android L03 - Styles and Themes
Android L02 - Activities and Adapters
Android L01 - Warm Up

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Cloud computing and distributed systems.
PDF
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The AUB Centre for AI in Media Proposal.docx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
Electronic commerce courselecture one. Pdf

Delphi L01 Intro