RAD Studio
ContentsIndex
PreviousUpNext
Creating and Using Component Templates

You can create templates that are made up of one or more components. After arranging components on a form, setting their properties, and writing code for them, save them as a component template. Later, by selecting the template from the Tool 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. 

Once you place a template on a form, you can reposition the components independently, reset their properties, and create or modify event handlers for them just as if you had placed each component in a separate operation.

To create a component template:

  1. Place and arrange components on a form. In the Object Inspector, set their properties and events as desired.
  2. Select the components. 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.
  3. Choose ComponentCreate Component Template.
  4. Specify a name for the component template in the Component Template Information edit box. The default proposal is the component type of the first component selected in step 2 followed by the word "Template." For example, if you select a label and then an edit box, the proposed name will be "TLabelTemplate." You can change this name, but be careful not to duplicate existing component names.
  5. In the Palette page edit box, specify the Tool palette page where you want the template to reside. If you specify a page that does not exist, a new page is created when you save the template.
  6. Next to Palette Icon, select a bitmap to represent the template on the palette. The default proposal will be the bitmap used by the component type of the first component selected in step 2. To browse for other bitmaps, click Change. The bitmap you choose must be no larger than 24 pixels by 24 pixels.
  7. Click OK.
To remove templates from the Tool palette, choose ComponentConfigure Palette.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!