Flag This Hub

Delphi Pascal Programming

By


Delphi 4 IDE
See all 3 photos
Delphi 4 IDE

The Delphi Pascal IDE

Anyone who has had experience of Visual Basic will notice the similaries of the Delphi and Visual Basic IDEs. Both use 'Forms' that are the basis of the building blocks of Windows programs, but of course the underlying languages are different.

Delphi uses the language known as Pascal to program functions and procedures for the objects placed on Forms, these can be buttons, menus, text boxes, sliders and many other objects. Some objects are visible at design time but become invisible at run time such as the Timer object. Its properties can be edited through the Object Inspector.


Easy To Use

The Delphi IDE is a rapid application development (RAD) environment, so it is possible to have the basic framework of a program set out within a few minutes, all the underlying Window and object creation is taken care of automatically.

All projects start off with 'Forms' to which users add Buttons, Menus, Toolbars and other components. Some components are visible all the time and others only at run time, that is, only when the program is running. One such invisible component is the Timer object that 'fires' an event or method.

Delphi also uses a system of 'Units', this means that if you develop your own routines they can be used again as separate units over and over again in other projects without having to edit the whole program.

There is also a free alternative

There is a free alternative open source version called Lazarus. This is very similar in appearance to the original Borland product and is available for Windows and Linux. It can even run on Mac OS X!

The image on the right shows the Lazarus IDE when running on Windows 7. Notice the 'Form' above the code editor window and the Object Inspector on the left. On the toolbar you can see some of the components that can be added to the form. And the routines that work in Delphi also work in Lazarus, but remember that you can only produce Windows programs with Delphi.

Source: gnucash.org

What Can I Do With It?

Very simple programs can be developed from games to near commercial quality applications such as an accounts manager. One well known accounts manager is GnuCash which is also open source so that you can get the source code to modify it if you wish. You will find it here:- www.gnucash.org

Some years ago, I found the source code to a screen saver that floats a circular visible portion of the desktop around the screen. I used some of the code as a basis for making a simple clock screen saver.

Object Oriented Programming

Delphi pascal is an object oriented programming environment - although I did not realise this myself until I began to look at Java programming with the Open University! I am currently having a go at programming my own little personal banking program and still finding out how to do things in Delphi.

I created an Account object and spent some time trying to add other functions to it, such as getBalance and setBalance - note these are function names wriiten in a similar way to Java.

Your new object is declared under the 'uses' section of the program code starting off with the word 'type' - think of this as type of object. The code is below.

Example of new object

type
TAccount=class(TObject)
private
//user function declarations - note this is a comment ignored by compiler
public
//user function declarations
end;

var
Account:TAccount;

What About Support?

There is plenty of help and support online through forums and open source sites, a quick search on Google will soon point you in the right direction. One of the best places to start is http://delphi.about.com and for Lazarus visit their site here.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working