The example template below will work with the ABC templates - it writes two variables into the Global Data section. To download the code click here. Please note that the numbers on the right in square brackets [4] are not part of the template - they are used in the template description below.
#TEMPLATE (GLOVAR, 'Illustrates adding Global Variables'),
FAMILY('ABC') [1] [1] Every .TPL file should have the #TEMPLATE statement at the start - the FAMILY() attribute can be 'ABC' or 'CW20' for the legacy/Clarion templates. [2] The symbol #! means the rest of the line is a comment - it will not appear in the generated code. [3] #HELP() - the specified help will give instructions on using the template and should be on the Clarion path. [4] APPLICATION shows that this extension template must be added at Global/Extensions and cannot be used at a procedure's extensions section. [5] This indicates the start of the Global Data section. In a PROCEDURE #EXTENSION this would be #LOCALDATA [6] To mark out the end of the global data you need to use #ENDGLOBALDATA (in a Procedure extension this would be #ENDLOCALDATA) One other point about adding global data like this - deleting the template will not delete the variables. They will already have been added to the Global Data window and should be deleted at that point. |