Tuesday, 30 March 2010

Delphi Tutorial # 1

Introducing Delphi

Delphi is an application development tool in Windows platform. Using this software you can build some Windows application. With visual approach, you can create application with some codes. Delphi based on Pascal Object language. If you are familiar with Pascal, it will be very easy to understand Delphi. But if you don’t know Pascal, you can learn both Delphi and Pascal in my tutorial at the same time.

There are some words that have to be clear before we start learning Delphi, such as application, form and component.

Application or application program is rows of codes to be done by computer. There are two kinds of application. Windows application and console application. Windows application is an application that runs under Windows. Non-Windows application, such as DOS application usually called console application. Generally, a Windows application has a form, but of course an application can have some forms. When we execute a form in a program, it will become a window.

A form usually contains some other components (a form is also a component). Label, button, edit box are components. Some components are visible. Label, button and edit box are visible components. The invisible component is called control. In Delphi, a project contains an application, and an application contains some forms.

Running the IDE

IDE or Integrated Development Environment is a part of Delphi where we can create our application. In IDE we can visually create a user interface and write some codes.

We can run the Delphi IDE from start menu. The main appearance of Delphi IDE shows a new project (project1) and a form (form1). Now we will see the Delphi IDE below :

-         Main menu contains some menus (File, Edit, Search…etc)

-         Toolbar contains some icons / tools.

-         Form Window is where you design your interface visually

-         Object Inspector contains two tabs : Properties and Events

-         Component Palette contains components you can place in the form.

Changing Form Properties

An object has some characteristics. A person has name, age, weight etc. As an object, a form also has some characteristics : name, height, width, color etc.

You can change the properties of form through the object inspector. A form has fifty properties. But only some of them we often use. Now let’s change the name and the caption of  our form from the object inspector, and see what happen to it :

Name : My_Form

Caption : My First Form

Why should we set a name for our form ? because if we have more than one form in our project, My_Form is more easily remembered rather than Form1, Form2…….

Saving Project

Now we’re going to save our first project by choosing File – Save All. You must create a new folder, ie : PracticingDelphi. After you create a new folder then give a unit name and project name.


And there will be some files saved in the folder :

.cfg : contains project configurations

.dof : contains project options (linker, compiler, searching directories etc)

.dpr : a project file

.res : contains standard windows resources

.dfm : a form file

.pas : a unit resources file (Pascal object codes)

Running Program

You can press F9 to run the program. And the result is only a blank windows, because we haven’t added anything to our form :

After we run the program Delphi create an executable file named MyProject.exe

Go to Next tutorial

4 comments:

  1. thanks for your visit on my blog...
    nice write about Delphi...

    ReplyDelete
  2. cool post but I'm often confused with the language of the programming language so that I was too lazy to learn

    ReplyDelete
  3. awesome post! I think it's no different with Vbasic, hmm I should learn delphi right here :D
    nice to know u!

    ReplyDelete
  4. Sugank, Pakde : thanks for dropping by
    Darin : Yes it is, it's only different language. But the algorithm and OOP concept are quite the same..

    ReplyDelete

These links are part of a pay per click advertising program called Infolinks. Infolinks is an In Text advertising service; they take my text and create links within it. If you hover your mouse over these double underlined links, you will see a small dialog box containing an advertisement related to the text. You can choose to move the mouse away and go on with your browsing, or to click on the box and visit the relevant ad. Click here to learn more about Infolinks Double Underline Link Ads.