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
- Specify an ancestor component on the Ancestor Component page.
- Specify the class name and other properties on the Component page.
- 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
- 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.
- 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.
- On the Ancestor Component page, select an ancestor component from the list.
- Click Next. This displays the Component page of the New VCL Component wizard.
To specify the class name and other properties
- 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.
- To change the default class name, enter a different class name in the Class Name textbox.
- 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.
- 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.
- Either enter or edit the search path in the Search Path textbox.
- 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
- On the Create Unit page, select the Create Unit radio button.
- Click Finish. The new unit opens in the Code Editor.
To install a unit into an existing package
- On the Create unit page, select the Install to Existing Package radio button.
- Click Next. This generates a list of existing packages.
- On the Existing Package page, select the package you want to install the unit into.
- Click Finish. The new unit opens in the Code Editor.
To install a unit into a new package
- On the Create unit page, select the Install to New Package radio button.
- Click Next.
- On the New Package page, enter a name for the package into the File Name textbox.
- In the Description textbox, enter a description of your new package .
- Click Finish. The new unit opens in the Code Editor.
To install a unit into the package created before starting the wizard
- On the Create Unit page, select Add unit to <my_new_package>.
- Click Finish. The new unit opens in the Code Editor.