Programming Templates

From RAD Studio
Jump to: navigation, search

Go Up to Creating Applications


Programming templates are commonly used skeleton structures that you can add to your source code and then fill in. Some standard code templates such as those for array, class, and function declarations, and many statements, are included with the product.

You can also write your own templates for coding structures that you often use. For example, if you want to use a for loop in your code, you could insert the following template:

for MyElem in MyList do
begin

end;
for (; ;) 
{

}

To insert a code template in the Code Editor, press Ctrl-j and select the template you want to use. You can also add your own templates to this collection.

To add a template:

  1. Choose Tools > Editor Options.
  2. Click the Code Insight tab.
  3. In the Templates section, click Add.
  4. Type a name for the template after Shortcut name, enter a brief description of the new template, and click OK.
  5. Add the template code to the Code text box.
  6. Click OK.

See Also