Within the Register procedure, call RegisterComponents to register the components in the classes array. RegisterComponents is a function that takes two parameters: the name of a Tool palette category and the array of component classes.
Set the Page parameter to the name of the category on the Tool palette where the components should appear. If the named category already exists, the components are added to that category. If the named category does not exist, Delphi creates a new palette category with that name.
Call RegisterComponents from the implementation of the Register procedure in one of the units that defines the custom components. The units that define the components must then be compiled into a package and the package must be installed before the custom components are added to the Tool palette.
procedure Register; begin RegisterComponents('System', [TSystem1, TSystem2]); {add to system category} RegisterComponents('MyCustomPage',[TCustom1, TCustom2]); { new category} end;
namespace Newcomp { void __fastcall PACKAGE Register() { TMetaClass* classes[1] = {__classid(TMyComponent)}; RegisterComponents("Miscellaneous", classes, 0); } }
namespace Mycomps { void __fastcall PACKAGE Register() { // declares an array that holds two components TMetaClass classes1[2] = {__classid(TFirst), __classid(TSecond)}; // adds a new palette page with the two components in the classes1 array RegisterComponents("Miscellaneous", classes1, 1); // declares a second array TMetaClass classes2[1]; // assigns a component to be the first element in the array classes2[0] = __classid(TThird); // adds the component in the classes2 array to the Samples page RegisterComponents("Samples", classes2, 0); } }
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|