User Tools

Site Tools


restrict_define_section_use_constraints_.htm
Navigation:  Templates > Template Language Reference > Complete Alpha Listing >====== #RESTRICT (define section use constraints) C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

#RESTRICT [, WHERE( expression ) ]

statements

#ENDRESTRICT

blk2blue.jpg

#RESTRICT Specifies conditions where a Template Code Section (#CODE, #CONTROL, #EXTENSION, #PROCEDURE, #PROGRAM, or #MODULE) can be used.
WHERE The #RESTRICT statements are excuted only when the expression is true.
expression A logical expression to limit execution of the #RESTRICT statements.
statements Template language code to #ACCEPT or #REJECT use of the section which contains the #RESTRICT structure.
#ENDRESTRICT Terminates the #RESTRICT structure.

The #RESTRICT structure provides a mechanism to limit the availability of a Template Code Section (#CODE, #CONTROL, #EXTENSION, #PROCEDURE, #PROGRAM, or #MODULE) at application design time to only those points where the generated code would be appropriate. Any WHERE clause on the Template Code Section is evaluated first, before #RESTRICT.

The #ACCEPT statement may be used to explicitly declare the section as appropriate for use. An implicit #ACCEPT also occurs if the #RESTRICT statements execute without encountering a #REJECT statement. The #REJECT statement must be used to specifically exclude the section from use. Both the #ACCEPT and #REJECT statements immediately terminate processing of the #RESTRICT code.

Example:

#CODE(ChangeControlSize,'Change control size')

#RESTRICT

   #CASE(%ControlType)

   #OF('LIST')

   #OROF('BUTTON')

     #REJECT

   #ELSE

     #ACCEPT

   #ENDCASE

 #ENDRESTRICT

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

 #PROMPT('New Width',@n04),%NewWidth

 #PROMPT('New Height',@n04),%NewHeight

%MyField{PROP:Width} = %NewWidth

%MyField{PROP:Height} = %NewHeight

See Also:     #ACCEPT ,#REJECT

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