Show: Delphi C++
Display Preferences

Registering the Component

From RAD Studio
Jump to: navigation, search

Go Up to Creating a Component with the Component Wizard


Registration is a simple process that tells the IDE which components to add to its component library, and on which pages of the Tool Palette they should appear. For a more detailed discussion of the registration process, see Making components available at design time.

To register a component:

To register a component implemented in Delphi:

  1. Add a procedure named Register to the interface part of the component's unit. Register takes no parameters, so the declaration is very simple:
  procedure Register;
Note: Although Delphi is a case insensitive language, the Register procedure is case sensitive and must be spelled with an uppercase R.
See more code details in Creating a Component with the Component Wizard.
If you are adding a component to a unit that already contains components, it should already have a Register procedure declared, so you do not need to change the declaration.
  1. Write the Register procedure in the implementation part of the unit, calling RegisterComponents for each component you want to register. RegisterComponents is a procedure that takes two parameters: the name of a Tool Palette category and a set of component types:
procedure Register;
begin
  Classes.RegisterComponents('MyComponents', [MyComponent]);
end;

If you are adding a component to an existing registration, you can either add the new component to the set in the existing statement, or add a new statement that calls RegisterComponents.

To register a component implemented in C++, add a procedure named Register to the component's unit:

namespace MyComponent
{
  void __fastcall PACKAGE Register()
  {
    TComponentClass classes[1] = {__classid(TMyComponent)};
    RegisterComponents("Samples", classes, 0);
  }
}

See more code details in Creating a Component with the Component Wizard.

If you are adding a component to a unit that already contains components, it should already have a Register procedure declared, so you do not need to change the declaration.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance