RAD Studio
ContentsIndex
PreviousUpNext
Registering the Component

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:

  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;

 

namespace Newcomp
{
  void __fastcall PACKAGE Register()
  {
  }
}

 

TComponentClass classes[1] = {__classid(TNewComponent)};

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.

Note: Although Delphi is a case insensitive language, the Register procedure is case sensitive and must be spelled with an uppercase R.
  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. 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.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!