|Basic Delphi - Getting Started|
The Delphi IDE
Throughout this tutorial, I'll be using Delphi 7. Versions prior to that are very similar so most of what follows applies equally to earlier versions. The "User Interface" of Delphi 2006 is quite different so, although most of the substance of what follows applies, you will need to adapt it to suit the Delphi 2006 environment.
I'll assume that you've installed Delphi 7 and started the program. The opening display is shown below.
The Delphi display can be confusing at first because it comprises a number of separate windows and you can see the Windows desktop, or other running applications, underneath. Initially five windows are open but more will appear as you develop a program. However, it becomes second nature once you get used to it!
The four most important windows are indicated in the picture above. The Main Window, The Object Inspector, The Code Window and the first form of an application - Form 1. We'll look at each of these in turn.
The Main Window contains the usual items of any Windows application - the Title Bar, a Menu Bar and a Toobar but there is an additional feature - the Component Palette. This is used to create the visual aspects of your application.
The Component Palette
A Windows application consists of a Form containing various objects such as buttons, text boxes, labels and so on. When creating an application, these objects - known as Components - are added to the Form by selecting the component on the Component palette and dragging it onto the Form.
Double-clicking the component on the Component Palette will automatically place the component at the centre of the Form. It can then be dragged into the correct position and resized. Alternatively, the component can be selected on the Component Palette with a single-click and placed on the Form by clicking and dragging on the Form at the required position.
There are a large number of components available on the palette and they are arranged in groups on different Tabs on the palette. Different versions of Delphi have different components (and different Tabs) so don't worry if you see components in the pictures here that you don't have. We'll only be using the basic components that all versions have.
Initially, the Form is blank except for the Title Bar and a grid of dots. The dots are to help visually align components as you add them to the Form. I find the initial spacing of the dots to be a little wide. They can be adjusted to be closer together by selecting Tools on the Main Window's Menu Bar. Select Environment Options... then the Designer Tab. The size of the grid is adjusted with the two "SpinEdit" Boxes.
The Object Inspector
The Code Window
If you click on an edge of the Code Window peeking out from behind Form 1, you will bring it to the front. This is the window where both you and Delphi will write the code which drives your program. There is already the basic framework of code written for you. As you add components to the Form, more framework is written for you - all you have to do is fill out the framework to create a functioning program!