RAD Studio |  |

Specifying the Components

Within the Register procedure, pass the component names in an open array, which you can construct inside the call to RegisterComponents.

Copy Code

    RegisterComponents('Miscellaneous', [TMyComponent]);

Copy Code

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

You could also register several components on the same page at once, or register components on different pages, as shown in the following code:

Copy Code

    procedure Register;
    begin
      RegisterComponents('Miscellaneous', [TFirst, TSecond]);            { two on this page... }
      RegisterComponents('Assorted', [TThird]);                         { ...one on another... }
      RegisterComponents(LoadStr(srStandard), [TFourth]);    { ...and one on the Standard page }
    end;

Copy Code

    TMetaClass classes[2] =
    {__classid(TNewComponent), __classid(TAnotherComponent)};

Copy Code

    //Another way to add a component to the array
    TMetaClass classes[2];
    classes[0] = __classid(TNewComponent);
    classes[1] = __classid(TAnotherComponent);

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