Chapter 4
Customizing the environment

This chapter explains some of the ways you can customize the Delphi development environment.

Organizing your work area

The IDE provides many tools to support development, including the Form Designer, Object Inspector, Code editor, Project Manager, Project Browser, and debugging windows. With so many tools available, you'll want to organize your work area for maximum convenience.

Docking tool windows

You can open and close individual tool windows and arrange them on the desktop as you wish. Many windows can also be docked to one another for easy management. Docking--which means either attaching windows to each other so that they move together or combining several windows into a tabbed "notebook"--helps you use screen space efficiently while maintaining fast access to tools.

From the View menu, you can bring up any tool window and then dock it directly to the Code editor for use while coding and debugging. For example, when you first open Delphi in its default configuration, the Code Explorer is docked to the left of the Code editor. If you want, you can add the Project Manager to the first two to create three docked windows.

While debugging, you can dock Watch and Breakpoint windows onto the Code editor.

You can also dock tools to form a tabbed window.

To dock a window, drag it over another window until the first window's rectangular outline becomes narrow and vertical; then release the mouse. To undock a window, click its title bar and drag it in any direction.

For more information...

Search for "docking tools" in the Help index.

Arranging menus and toolbars

The main window, which occupies the top of the screen, contains the menu, toolbars, and Component palette. You can reorganize its contents.

You can even separate parts from the main window and place them elsewhere on the screen or remove them from the desktop altogether.

You can also customize the toolbars by adding or deleting tools.

Customizing desktop settings

You can customize and save your desktop settings. A Desktop toolbar in the IDE includes a pick list of the available desktop layouts and two icons make it easy to customize the desktop.

Arrange the desktop as you want including displaying, sizing, and docking particular windows, and placing them where you want on the display. Click the Save current desktop icon on the Desktop toolbar or choose View|Desktops|Save Desktop.

For more information...

Search for "desktop layout" in the Help index.

Setting default project options

The Project Options dialog, accessed by choosing Project|Options, controls settings that are maintained separately for each application you develop. (See "Setting project and environment options".) However, by choosing the Default check box in the lower left corner of the dialog, you can save your selections as the default settings for all new projects.

Checking Default writes the current settings from the dialog to the options file DEFPROJ.DOF. To restore Delphi's original default settings, delete or rename the DEFPROJ.DOF file, which is located in the Delphi\Bin directory.

Specifying default projects and forms

When you choose File|New Application, a new project opens in the IDE. If you haven't specified a default project, Delphi creates its standard new application with an empty form. But you can select any item from the Projects page of the Object Repository (see "Templates and the Object Repository") as your default project. Once you've specified a default project, Delphi uses it as a template whenever you choose File|New Application. If you select a wizard as your default project, Delphi runs the wizard whenever you choose File|New Application; the wizard creates your new project based on your responses to a series of dialog boxes.

In the same way that you specify a default project, you can specify a default main form and a default new form. The default main form is the form created when you begin a new application. The default new form is the form created when you choose File|New Form to add a form to an open project. If you haven't specified a default form, Delphi uses a blank form.

You always have the option to override your default project or forms by choosing File|New and selecting from the New Items dialog box.

For more information...

See "projects, specifying default" and "forms, specifying default" in the Help index.

Setting tool preferences

The Environment Options dialog, accessed by choosing Tools|Environment Options, controls many aspects of the appearance and behavior of the IDE. Changes made in the Environment Options dialog are global; that is, they affect not just the current project, but projects that you open and compile later.

For more information...

Click the Help button on any page of the Environment Options dialog, or search for "Environment Options dialog box" in the Help index.

Customizing the Code editor

One tool you may want to customize right away is the Code editor. Several pages in the Tools|Editor Options dialog have editor settings. For example, you can choose keystroke mappings, fonts, margin widths, colors, syntax highlighting, tabs, and indentation styles.

You can also configure the Code Insight tools that you can use within the editor on the Code Insight page of Editor Options. See "Help with coding" to learn about these tools.

For more information...

Click the Help button on the following pages in the Editor Options dialog: General, Display, Key Mapping, Color, and Code Insight.

Customizing the Form Designer

The Preferences page of the Environment Options dialog has settings that affect the Form Designer. For example, you can adjust or disable the "grid snap" feature.

For more information...

Click the Help button on the Preferences page of the Environment Options dialog.

Setting Explorer options

The Code Explorer (described in "Exploring code") opens automatically when you start Delphi. You can disable this behavior--and set other options for the Code Explorer--from the Explorer page of the Environment Options dialog.

You can also set options such as the initial browser view and the browser scope which affect the Code Browser on the Explorer page of the Environment Options dialog. The Code Browser is shown in "Browsing project elements and structure".

For more information...

Click the Help button on the Explorer page of the Environment Options dialog.

Customizing the Component palette

In its default configuration, the Component palette displays many useful VCL objects organized functionally onto tabbed pages. You can customize the Component palette by

Arranging the Component palette

To add, delete, rearrange, or rename pages, or to hide or rearrange components, use the Palette Properties dialog. You can open this dialog in several ways:

For more information...

Click the Help button in the Palette Properties dialog.

Installing components

You can supplement the components in the VCL with custom components that you write yourself or obtain from third-party developers. To make new components available at design time, you need to install them in the IDE.

For more information...

To install third-party components, follow the vendor's instructions. To learn about writing your own components, see "Creating custom components" in the Developer's Guide or online Help.

Adding ActiveX controls

You can add ActiveX controls to the Component palette and use them in your Delphi projects. Choose Component|Import ActiveX Control to open the Import ActiveX dialog. From here you can register new ActiveX controls or select an already registered control for installation in the IDE. When you install an ActiveX control, Delphi creates and compiles a "wrapper" unit file for it.

For more information...

Choose Component|Import ActiveX Control and click the Help button.

Creating component templates

Component templates are groups of components that you add to a form in a single operation. Templates allow you to configure components on one form, then save their arrangement, default properties, and event handlers on the Component palette for reuse on other forms.

To create a component template, simply arrange one or more components on a form, set their properties in the Object Inspector, and select all of the components. Then choose Component|Create Component Template. When the Component Template Information dialog opens, you can select a name for the template, the palette page on which you want it to appear, and an icon to represent the template on the palette.

After placing a template on a form, you can reposition the components independently, reset their properties, and create or modify event handlers for them just as if you had placed each component in a separate operation.

For more information...

Search for "Template" in the Help index or choose Component|Create Component Template and press F1.

Customizing the Help system

Delphi's online Help system comprises more than a dozen WinHelp (.HLP) files and includes documentation for the IDE, the Visual Component Library, and additional products and tools supplied with Delphi. A utility called OpenHelp allows you to customize the Help system by choosing which files to make available through the master table of contents, the index, and the IDE's context-sensitive Help.

To start OpenHelp, choose Help|Customize.

OpenHelp lets you add any WinHelp files to Delphi's Help system, including documentation for third-party products. OpenHelp also allows you to remove references to obsolete Help files from the system registry.

For an overview of the Help files supplied with Delphi, see "Online Help".

For more information...

Choose Help|Customize, then choose Help|Contents from the OpenHelp main window.