コンポーネントの指定

提供: RAD Studio
移動先: 案内検索

Register 手続きの記述 への移動


Register 手続きの中では、コンポーネント名をオープン配列として渡します。この配列は、RegisterComponents の呼び出し文の中で作成できます。

RegisterComponents('Miscellaneous', [TMyComponent]);
TMetaClass classes[1] = {__classid(TNewComponent)};

また、複数のコンポーネントを同じページに一度に登録したり、異なるページにコンポーネントを登録することもできます。次のコードに例を示します。

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;
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);