Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add to the Delphi palette a component defined in a unit?

Tags:

delphi

I have a pas unit defining a component.

How can I add it to the palette? the only way I know is to include it in a package, is tehre a direct way to do it?

like image 441
LaBracca Avatar asked Dec 09 '10 13:12

LaBracca


1 Answers

In a package, have a unit that has a procedure named Register — the capitalization is important. In that procedure, call RegisterComponents on the component you'd like to appear on the Tool Palette.

You must use packages. That's the only way the IDE will load the executable code; it cannot execute DCU files directly. If you don't already have some other package to use, you can add your component to the DclUsr package.

With component libraries of any appreciable complexity, there will usually be at least two packages. There will be a run-time package that contains all the components, and then there will be a design-time package that contains the Register procedures.

like image 58
Rob Kennedy Avatar answered Nov 15 '22 05:11

Rob Kennedy