#CONTEXT (set template code generation context) 

Top  Previous  Next


#CONTEXT( section [, instance ] )




Sets the code generation context to emulate generating the named section.


One of the following valid symbols: %Application, %Procedure, %Module, or %Program.


A symbol containing a valid instance number of a code, control ,or extension template used in the named section.


Template language code.


Terminates the context change.

The #CONTEXT structure specifies template code that executes as if the source code for the named section were being generated. Once the context has been set, all the prompt symbols , declared symbols, and embeds in the named section are in scope and available for use in the #CONTEXT statements. If an instance is specified, the prompts for the corresponding component are brought into scope. #CONTEXT is valid for use anywhere in template code.

The key to understanding the use of the #CONTEXT structure is "as if the source code for the named section were being generated." This statement means that the statements are evaluated as if #GENERATE were executing. For example, a #EMBED statement within a #CONTEXT structure does not name a new embed point but instead, generates the contents of the named embed point.


#CODE(StealSomeCode,'Preparing to Process the Window Code Stealer')

#PROMPT('Procedure Name',FROM(%Procedure)),%ProcToStealFrom,REQ



#EMBED(%BeforeAccept,'Preparing to Process the Window')