Specifying the Components

From RAD Studio
Jump to: navigation, search

Go Up to Writing the Register Procedure

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

Delphi

RegisterComponents('Miscellaneous', [TMyComponent]);

C++

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:

Delphi

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

C++

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

See Also