Navigation: Templates > Template Language Reference > Complete Alpha Listing >====== #PREPARE (setup prompt symbols) ====== | |
#PREPARE
statements
#ENDPREPARE
#PREPARE | Begins a prompts symbol setup section. |
statements | Template language statements to fix multi-valued symbols to the values needed to process the #PROMPT or #BUTTON statement preceding the #PREPARE. |
#ENDPREPARE | Terminates the section. |
The #PREPARE structure contains Template language statements to fix multi-valued symbols to the values needed to process the #PROMPT or #BUTTON statements preceding the #PREPARE.
A #PREPARE section that precedes all the prompts is executed once, before the prompts are added to a window. In particular, if the prompts are displayed on the procedure properties screen, editing the window definition and returning does not execute the prepare code.
Example:
#CODE (SetProperty, 'Set a property on a control')
#PREPARE
#DECLARE(%Choices),MULTI
#DECLARE(%NextLine)
#FREE(%Choices)
#OPEN('property.clw'),READ
#READ(%NextLine)
#LOOP WHILE(%NextLine <;> %Eof)
#! Exclude PROPLIST: properties
#IF (SUB(%NextLine, 1, 5) = 'PROP:')
#ADD(%Choices, SUB(%NextLine, 1, INSTRING(' ',%NextLine)-1))
#END
#READ (%NextLine)
#END
#CLOSE,READ
#ENDPREPARE
#PROMPT('Control:', FROM(%Control)),%Target
#PROMPT('Property:', FROM(%Choices)),%Selection
#PROMPT('Value:', @s255),%TargetValue
%target{%Selection} = %TargetValue