Creating and using Component templates provides a simple, quick way of configuring and saving groups of components in Delphi.
Difficulty: Easy
Time Required: 5 minutes
Here's How:
- Start Delphi and place / arrange components on a form.
- In the Object Inspector, set their properties and events as desired.
- Select the components.
- Choose Component | Create Component Template...
- Specify a name for the component template in the Component Name edit box (be careful not to duplicate existing component names).
- In the Palette Page edit box, specify the Component palette page where you want the template to reside.
- Under Palette Icon, select a bitmap to represent the template on the palette.
- Click OK.
Tips:
- In step 3, the easiest way to select several components is to drag the mouse over all of them. Gray handles appear at the corners of each selected component.
- In step 6, if you specify a page that does not exist, a new page is created when you save the template.
- To remove templates from the Component palette, choose Component|Configure Palette.
- By selecting the template from the Component palette, you can place the preconfigured components on a form in a single step; all associated properties and event-handling code are added to your project at the same time.

