| **Navigation:**  [[templates.htm|Templates]] > [[tlrcontents.htm|Template Language Reference]] > Complete Alpha Listing >====== #CONTEXT (set template code generation context) {{c6h0068.jpg|C6H0068.jpg}} ====== | [[ comment specify comment column .htm|{{btn_prev_n.gif|Previous page}}]][[tlrcontents.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ control define a control template .htm|{{btn_next_n.gif|Next page}}]] | | || **#CONTEXT( **//section// [, //instance// ] **)** //statements// **#ENDCONTEXT** {{blk2blue.jpg|blk2blue.jpg}} | **#CONTEXT** | Sets the code generation context to emulate generating the named //section//. | | //section// | One of the following valid symbols: %Application, %Procedure, %Module, or %Program. | | //instance// | A symbol containing a valid instance number of a code, control ,or extension template used in the named //section//. | | //statements// | Template language code. | | **#ENDCONTEXT** | 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. **Example:** **#CODE(StealSomeCode,'Preparing to Process the Window Code Stealer')** **#PROMPT('Procedure Name',FROM(%Procedure)),%ProcToStealFrom,REQ** **#FIX(%Procedure,%ProcToStealFrom)** **#CONTEXT****(%Procedure)** ** #EMBED(%BeforeAccept,'Preparing to Process the Window')** **#ENDCONTEXT** **See Also:     **[[ code define a code template .htm|#CODE]] , [[ control define a control template .htm|#CONTROL]] , [[ extension define an extension template .htm|#EXTENSION]]