RAD Studio |  |

Declaring the Register Procedure

Registration involves writing a single procedure in the unit, which must have the name Register. The Register procedure must appear in the interface part of the unit, and (unlike the rest of Delphi) its name is case-sensitive.

Note: Although Delphi is a case insensitive language, the Register procedure is case sensitive and must be spelled with an uppercase R.
The following code shows the outline of a simple unit that creates and registers new components:
Copy Code

    unit MyBtns;
    interface
    type
      ...                                                { declare your component types here }
    procedure Register;                          { this must appear in the interface section }
    implementation
      ...                                               { component implementation goes here }
    procedure Register;
    begin
      ...                                                          { register the components }
    end;
    end.

Copy Code

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

Within the Register procedure, call RegisterComponents for each component you want to add to the Tool palette. If the unit contains several components, you can register them all in one step.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!