Using the New Component Wizard
Go Up to New Component
You can use the Component > New Component wizard to create either a new VCL component or a new FireMonkey component for your application.
If you have a project open or if you are running a single personality product, the wizard detects the personality and creates the appropriate type of component (Delphi or C++).
Contents
Summary: Steps in Creating a New Component
- Create a new skeleton package (this step is optional but recommended).
- Start the wizard and specify the personality, framework, and platform.
- Select an ancestor component on the Ancestor Component page.
- Specify the class name and other properties on the Component page .
- Choose how you want to create and install the 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.
- Add the unit to a skeleton package you create in the current project before starting the wizard.
Note: For information about creating Win64 components, see New Component.
Create a Skeleton Package (Optional)
- Create a new skeleton package for the new component by choosing File > New > Other > Delphi or C++ Projects.
- Double-click the Package icon. This step adds a new package project to the Projects Window and enables the Add unit to <my_new_package> option on the Create unit page of the wizard.
Start the Wizard and Specify the Personality, Framework, and Platform
The Personality, Framework, and Platform page of the wizard is displayed only if you start the wizard when no project is open in the IDE.
- 1. In the IDE, choose one of the following:
- Component > New Component
- File > New > Other > Delphi Projects > Delphi Files > Component > Delphi files
- File > New > Other > C++Builder Projects > C++Builder Files > Component > C++ files
- 2. If you see the first page of the New Component wizard (the Personality, Framework and Platform page), select the personality (Delphi or C++), framework (library), and platform you want to use. Choose from:
- VCL for C++ or VCL for Delphi
- VCL is supported on Windows only.
- VCL for C++ or VCL for Delphi
- FireMonkey for C++ or FireMonkey for Delphi
- Delphi supports FireMonkey on Win32, Win64, 64-bit macOS, 64-bit iOS Device, and Android. It is also supported on Linux using FmxLinux, an add-on available from GetIt.
- C++Builder supports FireMonkey on Win32, Win64, 64-bit iOS Device, and Android.
- Click Next. The Ancestor Component page appears.
- FireMonkey for C++ or FireMonkey for Delphi
Select the Ancestor Component
- On the Ancestor Component page, review the list of all the components, along with the name of the unit that defines each component. Select an ancestor component from the list.
- Click Next. The Component page appears.
Specify the Class Name and Other Properties
- On the Component page, the fields are prepopulated for:
- Class Name
- Palette Page
- Unit name
- 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 the last step in this procedure.
- 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. The default search path is the value set for the library path on:
- Tools > Options > Environment Options > C++ Options > Paths and Directories (C++)
- Tools > Options > Environment Options > Delphi Options > Library (Delphi)
- Click Next. This opens the Create unit page of the wizard.
Create and Install the Unit
- You have four choices on the Create unit page:
- 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 before starting the wizard, 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 Package 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 a skeleton package created before starting the wizard
- On the Create Unit page, select Add unit to <my_new_package> . (This option is enabled when you create a skeleton package before starting the wizard, as described in Create a skeleton package, above.)
- Click Finish. The new unit opens in the Code Editor.