Using the New Component Wizard

From RAD Studio
Jump to: navigation, search

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++).

Summary: Steps in Creating a New Component

  1. Create a new skeleton package (this step is optional but recommended).
  2. Start the wizard and specify the personality, framework, and platform.
  3. Select an ancestor component on the Ancestor Component page.
  4. Specify the class name and other properties on the Component page .
  5. 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)

  1. Create a new skeleton package for the new component by choosing File > New > Other > Delphi or C++ Projects.
  2. Double-click the Package icon. This step adds a new package project to the Project Manager 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.
  • FireMonkey for C++ or FireMonkey for Delphi
    Delphi supports FireMonkey on Win32, Win64, OS X, 32-bit and 64-bit iOS Device, iOS Simulator, and Android.
    C++Builder supports FireMonkey on Win32, Win64, OS X, 32-bit and 64-bit iOS Device, iOS Simulator, and Android.
  • Click Next. The Ancestor Component page appears.

Select the Ancestor Component

  1. 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.
  2. Click Next. The Component page appears.

Specify the Class Name and Other Properties

  1. 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.
  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. The default search path is the value set for the library path on:
  6. 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
  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 Package 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 a skeleton package created before starting the wizard
  1. 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.)
  2. Click Finish. The new unit opens in the Code Editor.

See Also