|
|
 |
 |
| Join the Discussion |
"Post your views and comments to this chapter of the free Delphi Programming Course"
Discuss! |
|
 |
 |
|
|
 |
 |
 |
Form1 window

Each time you start Delphi, a new project is created that consists of one *empty* window. A typical Delphi application, in most cases, will contain more than one window - those windows are referred to as forms. In our case this form has a name, it is called Form1. This form can be renamed, resized and moved, it has a caption and the three standard minimize, maximize and close buttons. As you can see a Delphi form is a regular Windows window.
Unit1.pas - the Code Editor window

If the Form1 is the active window and you press [F12], the Code Editor window will be placed on top. As you design user interface of your application, Delphi automatically generates the underlying Object Pascal code. More lines will be added to this window as you add your own code that drives your application. This window displays code for the current form (Form1); the text is stored in a (so-called) unit - Unit1. You can open multiple files in the Code Editor. Each file opens on a new page of the Code editor, and each page is represented by a tab at the top of the window.
The Object Inspector
Each component and each form, has a set of properties - such as color, size, position, caption - that can be modified in the Delphi IDE or in your code, and a collection of events - such as a mouse click, keypress, or component activation - for which you can specify some additional behavior. The Object Inspector displays the properties and events (note the two tabs) for the selected component and allows you to change the property value or select the response to some event.
For example, each form has a Caption (the text that appears on it's title bar). To change the caption of Form1 first activate the form by clicking on it. In the Object Inspector find the property Caption (in the left column), note that it has the 'Form1' value (in the right column). To change the caption of the form simply type the new text value, like 'My Form' (without the single quotes). When you press [Enter] the caption of the form will change to My Form.
Note that some properties can be changed more simply, the position of the form on the screen can be set by entering the value for the Left and Top properties - or the form can be simply dragged to the desired location.
The Object TreeView
Above the Object Inspector you should see the Object TreeView window. For the moment it's display is pretty simple. As you add components to the form, you'll see that it displays a component's parent-child relationships in a tree diagram. One of the great features of the Object TreeView is the ability to drag and drop components in order to change a component container without losing connections with other components.
The Object TreeView, Object Inspector and the Form Designer (the Form1 window) work cooperatively. If you have an object on a form (we have not placed any yet) and click it, its properties and events are displayed in the Object Inspector and the component becomes focussed in the Object TreeView.
Closing Delphi
To stop working in the Delphi IDE, you can point to the File | Exit option in the main menu. If you have made changes to the current project, you'll be asked if you want to save the changes. Since this is the first time we've done some changes to the project in this course, and we do not yet know how a project is saved and what are the options, select [No].
To the next chapter: A Beginner's Guide to Delphi Programming
This is the end of the second chapter, in the third chapter, we'll explore the ways of getting help from Delphi: about the Object Pascal, user interface, VCL, ...
If you need any kind of help at this point, please post to the Delphi Programming Forum where all the questions are answered and beginners are treated as experts.
First page > The Delphi IDE; Main menu, toolbar > Page 1, 2
A Beginner's Guide to Delphi Programming: Next Chapter >>
>> Chapter 3: Creating your first *Hello World* Delphi Application
|