User Tools

Site Tools


customizing_default_templates.htm
Navigation:  Templates > Template Language Reference > Introduction > Template Structure >====== Customizing Default Templates C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

There are two methods for customizing the templates:

black.jpg

1.You can edit the template source code in the .TPL and .TPW files.

It is always a good idea to make a backup copy before making any modifications to the shipping templates.

When directly editing the template source code, you can change the type of source code it generates, or the logic it uses to generate the code. This is how you can make your templates generate source code the way you would write it if you were hand-coding the application.

You can also extend the functionality of the templates by adding your own features. For example, you may want to add prompts to each procedure template that allow you to generate a “comment block” at the beginning of each procedure containing procedure maintenance comments from the programmer maintaining the application.

Adding the following code to the end of any existing template set accomplishes this modification:

#EXTENSION(CommentBlock,'Add a comment block to the procedure'),PROCEDURE

 #PROMPT('Comment Line',@S70),%MyComment,MULTI('Programmer Comments')

#ATSTART

 #FOR(%MyComment)

 !%MyComment

 #ENDFOR

#ENDAT

This code adds an extension template that is available for any procedure in the application. When you design your procedure, add the CommentBlock extension template to the procedure, then add comments to the Comment Line prompt each time you modify the procedure. At source generation time, each comment line will appear following an exclamation point (!). The block of comments appears in the code just before the PROCEDURE statement.

If you want this extension to be used in all the procedures you write, go into the Template Registry and add the extension to all the default procedures for each procedure template. This way, you can make sure it is always used, and you can even place its prompts on the Procedure Properties dialog by checking the Show on Properties box as you add the extension to the procedure template.

Once you make the changes, either choose the Setup BLTTRIA.jpg Template Registry menu selection, open an existing application, or create a new application. Make sure the Re-register When Changed box is checked in the Registry Options dialog. The Application Generator automatically pre-processes the templates to update the registry when you have made changes to the template code files.

black.jpg

2.You can add to or edit the default user interface procedure template elements such as the standard window designs and report layouts, or your standard global and local data variables using the Template Registry.

When you highlight a procedure template in the Template Registry and press the Properties button, the Procedure Properties dialog appears, without all the custom prompts you would normally see when developing an application. Any button which is not dimmed in the Template Registry is available to you to create the default starting point for the procedure.

You can set up the procedure for the starting point that will get you furthest toward a complete procedure while requiring the least amount of customization from you at application design time. If the procedure allows it, you may use the window and report formatters, or define additional data, by pressing the appropriate buttons.

Once you've customized your template registry, you can also export your customizations to template source code files. This is useful for sharing your customizations with other developers.

To update the template source code with the customizations made in the Template Registry, press the Regenerate button in the Template Properties dialog. This updates the .TPL and .TPW files with the changes made.

customizing_default_templates.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1