Adding New Template Sets 

Top  Previous  Next

Adding another set of templates, whether from a third-party vendor or templates you have written yourself, is a very simple process. There is only one requirement for the new template set; a #TEMPLATE statement to identify the set for the template registry. Of course, it also needs to have the specific procedure, code, control, and extension templates to add to the template registry.

For example, the following code is completely valid as a template set with nothing else added:

 

#TEMPLATE(PersonalAddOns,'My personal Template set')

#CODE(ChangeProperty,'Change control property')

 #PROMPT('Control to change',CONTROL),%MyField,REQ

 #PROMPT('Property to change',@S20),%MyProperty,REQ

 #PROMPT('New Value',@S20),%MyValue,REQ

%MyField{%MyProperty} = '%'MyValue' #<!Change the %MyProperty of %MyField

 

When you register this template set, it will appear in the template registry as Class PersonalAddOns containing just the ChangeProperty code template.

Once a template set is registered in the template registry, all its components are completely available to the programmer for their application development, along with all the components of all other registered template sets. This allows the programmer the flexibility to "mix-and-match" their components during development.

For example, the programmer could create a procedure from a procedure template in the standard Clarion template set, populate it with a control template from a third-party vendor, insert a code template into an embed point from another third-party vendor, then add an extension template from their own personally written template set. At source generation time, all these separate components come together to create a fully functional procedure that performs all the tasks required by the programmer (and nothing else). This is the real power behind Clarion's Template-oriented programming!