User Tools

Site Tools


extension_define_an_extension_template_.htm
Navigation:  Templates > Template Language Reference > Complete Alpha Listing >====== #EXTENSION (define an extension template) C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

#EXTENSION( name, description [, target ] ) [, HLP( helpid ) ] [, MULTI ] [, DESCRIPTION( expression ) ] ]

[, SHOW ] [, PRIMARY( message [, flag ] ) ] [,| APPLICATION( [ child(chain) ] )| ]

PROCEDURE                              

[, REQ( addition [,| BEFORE| ] ) [,| FIRST| ] [, PRIORITY( number )]

AFTER         LAST

blk2blue.jpg

#EXTENSION Begins an extension template that generates code into embedded source code points to add some functionality not associated with specific controls.
HLP Specifies on-line help is available.
name The label of the extension template. This must be a valid Clarion label.
description A string constant describing the extension template.
target A string constant that specifies the source language the extension template generates. If omitted, it defaults to Clarion.
MULTI Specifies the #EXTENSION may be used multiple times in a given application or procedure.
DESCRIPTION Specifies the display description of a #EXTENSION that may be used multiple times in a given application or procedure.
expression A string constant or expression that contains the description to display.
SHOW Specifies the #EXTENSION prompts are placed on the procedure properties window.
PRIMARY Specifies a primary file for the extension must be placed in the procedure's Data / Tables Pad.
message A string constant containing a message that appears in the Data / Tables Pad next to the #EXTENSION's Primary file.
flag Either OPTIONAL (the file is not required), OPTKEY (the key is not required), or NOKEY (the file is not required to have a key).
APPLICATION Tells the Application Generator to make the #EXTENSION available only at the global level.
child(chain) The name of a #EXTENSION with the PROCEDURE attribute to automatically populate into every generated procedure when the #EXTENSION with the APPLICATION attribute is populated.
PROCEDURE Tells the Application Generator to make the #EXTENSION available only at the local level.
REQ Specifies the #EXTENSION requires a previously placed #CODE, #CONTROL, or #EXTENSION before it may be used.
addition The name of the previously placed #CODE, #CONTROL, or #EXTENSION.
BEFORE Legacy attribute, replaced by PRIORITY.
AFTER Legacy attribute, replaced by PRIORITY.
FIRST Equivalent to PRIORITY(1).
LAST Equivalent to PRIORITY(10000).
PRIORITY Specifies the order inwhich the #EXTENSION is generated. The lowest value generates first. If omitted, the PRIORITY is assumed to be 5000.
number An integer constant in the range 1 to 10000.

#EXTENSION defines the beginning of an extension template containing code to generate into the application or procedure to provide some functionality not directly associated with any control. A #EXTENSION section may contain Template and/or target language code. The #EXTENSION section is terminated by the first occurrence of a Template Code Section (#PROGRAM, #MODULE, #PROCEDURE, #CONTROL, #CODE, #EXTENSION, or #GROUP) statement, or the end of the file. Within a single Template set, separate #EXTENSION sections may not be defined with the same name.

#EXTENSION can only generate code into #EMBED embedded source code points using the #AT/#ENDAT structure. A #EXTENSION section may contain #PROMPT statements to prompt for the values needed to generate proper source code. These prompts appear when you edit an Extension from the Extensions button in the environment. It may also contain #EMBED statements which become active only if the #EXTENSION section is used.

#RESTRICT can restrict appearance of the #EXTENSION in the list of available extensions based on an expression or Template language statements.

Example:

#EXTENSION(Security,'Add password'),PROCEDURE

 #PROMPT('Password File',FILE),%PasswordFile,REQ

 #PROMPT('Password Key',KEY(%PasswordFile)),%PasswordFileKey,REQ

 #PROMPT('Password Field',COMPONENT(%PasswordFileKey)),%PasswordFileKeyField,REQ

 #AT(%DataSectionBeforeWindow)

LocalPswd   STRING(10)

SecurityWin WINDOW

            ENTRY(@s10),USE(LocalPswd),REQ,PASSWORD

            BUTTON('Cancel'),KEY(EscKey),USE(?CancelPswd)

           END

 #ENDAT

 #AT(%ProcedureSetup)

OPEN(SecurityWin)

ACCEPT

 CASE ACCEPTED()

 OF ?LocalPswd

   %PasswordFileKeyField = LocalPswd

   GET(%PasswordFile,%PasswordFileKey)

   IF NOT ERRORCODE()

     LocalPswd = 'OK'

   END

 BREAK

 OF ?CancelPswd

  CLEAR(LocalPswd)

  BREAK

 END

END

CLOSE(SecurityWin)

IF LocalPswd <;> 'OK' THEN RETURN.

 #ENDAT

See Also:     #EMBED , #WHERE , #RESTRICT , #AT (insert code in an embed point)

extension_define_an_extension_template_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)