The IDE (Integrated Development Environment)

The Delphi programming environment includes many features to assist with programming and project management and to make things easier for the programmer. You should become familiar with many of these features without having to make a conscious effort to remember them but check this list from time to time to remind you of the many features at your disposal. Also, you should remember the kind of facilities provided by the Delphi IDE in case you are asked to name and/or describe a number of tools or utilities to help with programming tasks. 

Editor

To set different colours for the various parts of a program choose Tools/Editor Options:

Use Ctrl-Tab to move from one page to another (this will generally be from one unit to another). Drag units into a desired sequence to reduce time moving between them with Ctrl-Tab. Use Ctrl-Shift-Tab to move back a page. 

Use Ctrl-click on an identifier (not a keyword) in the editor and the editor will move to where that item is defined. Backwards and forwards buttons appear in the top right corner of the editor so you can move back or forwards through your selections.

When entering properties or methods of controls such as list boxes you can take advantage of code completion (this is in the Implementation section of a unit). As you type the name of the control enter a '.'  and then pause slightly to allow Delphi to display the list of properties and methods for that object. As you type the first letter of the property or method the rest will be filtered out so you can move quickly to the one you want (or check if a property or method is available for that object). After an ':=' symbol Delphi will provide a list of valid identifiers that will match the left hand side of the expression.

Code completion also works in the Interface section of a unit, inside a class definition, where pressing Ctrl/spacebar will bring up a list of the virtual and abstract methods that you can override, along with base class properties and some other advanced features such as the methods of implemented interfaces and system messages. If you create a blank line in a class definition and press Ctrl/spacebar Delphi will display a list of symbols in units not declared in your project and will add the relevant unit to the uses list if you add something from the list.

Code templates allow you to add a pre-defined block of instructions such as the outline of a for loop. To display a list of code templates press Ctrl-J. You should be able to add your own templates from the Code Insight page of the Environment Options dialogue box.

Delphi shows the parameters required by a function or method (use Ctrl-Shift-spacebar to bring up the display).

Class completion means you need only write a procedure or function header in either the Interface section or the Implementation section of a unit. When you have written a procedure declaration press Ctrl-Shift-C and Delphi will create the corresponding header in the other part of the unit - no need to use Copy and Paste!

Choose each program element from the drop-down list and choose a colour from the palette (this dialogue box was probably built in Delphi, so the colour box may look familiar). 

Object Inspector

This is used to set properties of components at design-time and is at the heart of Delphi programming. Properties that refer to other components, such as a PopupMenu, are shown in a different colour (default red, properties in green) and their properties can be seen and changed by expanding them from their host property. In the example below we see the Images properties for a ComboBoxEx component it can be manipulated without switching to the ImageList component.

Object Tree View

This shows all of the components and objects on a form, in a tree representing their relations. One relation is parent-child, which can be seen in a panel:

The object tree also shows other relations between objects such as owner-owned.

The object tree can be used to add components to a form by dragging them from the palettes onto the appropriate part of the tree.

Diagram View

The diagram view of the code editor can be used to document aspects of a project, in particular the relations between objects. This is well documented in the Delphi Help system - use the Find page of the Help Search box and enter 'Diagram page' or activate the diagram page by clicking its tab and press the F1 key. Items are placed in the diagram window by dragging them from the Object Tree panel. 

With the Property Connector icon selected you can drag from the dependent control to the related control to set a related property. In the example below you drag from the Label to the Edit control to set the FocusControl property of the Label (this sets the control which will be activated by the accelerator key in the label caption). You can also drag from the Edit2 box to the PopMenu1 box to set the PopUpMenu property in the Edit control to this particular menu. The line pointing away from the Edit2 box is called a property relationship; the line points away from the component that has the property (the Edit box) towards the component referred to by the property (the popup menu). This could be used for documentation as it shows the relationship between the various components.

The resulting diagram can be printed or otherwise incorporated in documentation. In this example we also see that the Label and the Edit box are contained by a panel. For more details see the Help file.

Code Explorer

This is usually docked on the left side of the code window. It shows all of the types, variables and routines defined in a unit, along with other units in appearing uses statements. Double clicking an item in the code explorer takes the editor to the definition of that object in the code. You can control the level of detail displayed in the Code Explorer on the Explorer tab in the Environment Options dialogue box.

Form Designer

Components are placed on a form by double-clicking on the icon in the palettes or clicking once on the icon and dragging out a rectangle on the form. Use Ctrl + arrow keys to fine-tune the position of controls and Ctrl-Shift + arrow keys to move them by grid intervals. Use the Shift key or the mouse to select multiple components and then use View-Alignment Palette to align them as required. 

Component Palette

The Component Palette displays all the controls currently available for you as you design your forms. To display a list of palette tabs, rather than scrolling along them, right click the palette area, choose the Tabs option from the popup menu and select the required palette from the list.

Templates and Frames

A section of code can be saved as a template for use elsewhere in a project. To create a template select one or more components and choose Component/Create Component Template. Use Component/Configure Palette to edit the contents of the palettes (for example to delete unwanted items). More detail is given on frames elsewhere.

Project Manager

The project manager shows a tree view of a project and has extensive facilities for managing the items shown, deleting, activating and adding new projects. It shows all the forms and units that make up a project. 

Project Explorer

Choose View/Browser to open the project explorer. This list classes, units and globals and will display code from your own project or the details of the objects in the VCL (Visual Control Library). Double clicking on an item leads to a second window and further double clicking on objects will open up their code modules, so you can look at the definition of TObject, for instance.

Object Repository

When you select File/New Delphi displays a box with all of the objects that you can create and work on. The most common choices at this stafe will be Application (for VCL) and Console Application (for a non-Windows program).

Delphi Home