Code Templates

Top  Previous  Next

The Code Templates feature allows you to create code snippets that you can insert in your source code.

Code templates are created in the Options window, Code Templates tab.

MZ-Tools offers the following ways to show a list of code templates that you can add to the source code:

  • The Tools | MZ-Tools | Add Code Template... menu.
  • The MZ-Tools | Add Code Template... context menu of a code window.
  • The Add Code Template... button on the MZ-Tools toolbar.
  • The shortcut customized in the Options window, Shortcuts tab.

The Code Template Selection window is the following:

code_template_selection

You can also define a keyboard shortcut for each code template. When the keyboard shortcut is employed, the associated code template will be inserted into the code at the insertion point without showing the Code Template Selection window.

Code templates can include predefined variables (such as author, current date, procedure name, cursor position after insertion, etc.) and can also include user-defined variables, that is, your own variables. When you insert into the source code a code template with user-defined variables, you are asked the values of those variables:

code_template_variable_values

For example, in this case the code template (intended to create a collection class) includes a user-defined variable which is the name of the class of the objects that the collection will hold, used in the Item() and Add() methods.

See Also:

Code Templates Customization

Shortcuts Customization

Predefined Variables