RAD Studio |  |

Creating a New VCL Component
See Also
Collapse All

You can use the New VCL Component wizard to create a new VCL component for your application. The wizard detects the personality of the product you are using and creates the appropriate type of component.

Metaprocedure: Creating a new VCL component

1. Specify an ancestor component on the Ancestor Component page.
2. Specify the class name and other properties on the Component page.
3. Choose from three methods for creating a unit:
   - Create a unit, on the Create unit page
   - Install the unit to an existing package, on the Existing package page
   - Install the unit as a new package, on the New Package page

To specify an ancestor component

1. Create a new package for the new component by choosing FileNewOtherDelphi Projects and double-clicking the Package icon. This step adds a new package to the Project Manager and enables the Add unit to <my_new_package> option on the Create unit page.
2. In the IDE, choose ComponentNew VCL Component. This step displays the first page of the New VCL Component wizard (the Ancestor Component page) and loads the page with names of components, along with the unit that defines each component.
3. On the Ancestor Component page, select an ancestor component from the list.
4. Click Next. This displays the Component page of the New VCL Component wizard.

To specify the class name and other properties

1. On the Component page, the fields are prepopulated for Class Name, Palette Page, Unit name, and Search path. You can either accept the default values for these fields, or you can change the values by using the following steps. If you want to accept the default values, skip to step 6.
2. To change the default class name, enter a different class name in the Class Name textbox.
3. To change the default palette page for the component, in the Palette Page textbox, either enter the name of your chosen Tool Palette area, or click the down-arrow to select from palette page areas.
4. In the Unit Name textbox, you can either enter or edit the full path of the unit name. Click [...] to browse for and select the unit you want.
5. Either enter or edit the search path in the Search Path textbox.
6. Click Next. This opens the Create unit page of the wizard. The choices on the Create unit page are:
   - Create Unit
   - Install to Existing Package
   - Install to New Package
   - Add unit to <my_new_package> (this selection is present only if you create a new package in the very first step, above)

To create a unit

1. On the Create Unit page, select the Create Unit radio button.
2. Click Finish. The new unit opens in the Code Editor.

To install a unit into an existing package

1. On the Create unit page, select the Install to Existing Package radio button.
2. Click Next. This generates a list of existing packages.
3. On the Existing Package page, select the package you want to install the unit into.
4. Click Finish. The new unit opens in the Code Editor.

To install a unit into a new package

1. On the Create unit page, select the Install to New Package radio button.
2. Click Next.
3. On the New Package page, enter a name for the package into the File Name textbox.
4. In the Description textbox, enter a description of your new package .
5. Click Finish. The new unit opens in the Code Editor.

To install a unit into the package created before starting the wizard

1. On the Create Unit page, select Add unit to <my_new_package>.
2. Click Finish. The new unit opens in the Code Editor.

See Also

VCL Overview

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!