| **Navigation:**  [[templates.htm|Templates]] > [[tlrcontents.htm|Template Language Reference]] > Annotated Examples > Procedure Template: Window >====== %StandardAcceptedHandling #GROUP {{c6h0068.jpg|C6H0068.jpg}} ====== | [[ standardwindowhandling group.htm|{{btn_prev_n.gif|Previous page}}]][[tlrcontents.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ standardcontrolhandling group.htm|{{btn_next_n.gif|Next page}}]] | | || This #GROUP generates all the code to handle field-specific events for the procedure. It generates its code inside the Window Template's CASE FIELD() structure. **#GROUP(%StandardAcceptedHandling)** **#FOR(%Control),WHERE(%ControlMenu)** **  #FIX(%ControlEvent,'Accepted')** **  #MESSAGE('Control Handling: ' & %Control,3)** **  #SUSPEND** **#?OF %Control** **  #EMBED(%ControlPreEventHandling,'Control Event Handling, before generated code') %|** ** ,%Control,%ControlEvent** **  #INSERT(%FieldTemplateStandardHandling)** **  #EMBED(%ControlEventHandling,'Internal Control Event Handling')  %|** **        ,%Control,%ControlEvent,HIDE** **  #EMBED(%ControlPostEventHandling,'Control Event Handling, after generated code') %|** **        ,%Control,%ControlEvent** **  #RESUME** **#ENDFOR** This code starts with the #FOR(%Control),WHERE(%ControlMenu) statement. The WHERE attribute limits this #FOR loop to only those instances of %Control that contain menu items. The #FIX statement ensure that this code only deals with Accepted events. The #MESSAGE statement displays its message during source generation. #SUSPEND begins a conditional source generation section. The #?OF %Control statement conditionally generates an OF clause to the CASE ACCEPTED() structure for the currently processing instance of %Control. This line of code, since it is prefaced with #?, will only generate if there is some other code generated within it, eliminating an empty OF clause. All three #EMBED statements have ",%Control,%ControlEvent" appended to the end, so the programmer will have a separate embed point available for every instance of the %ControlEvent symbol within every instance of the %Control symbol. For this group, this only means the Accepted event. The #INSERT(%FieldTemplateStandardHandling) statement generates code to handle all the Actions dialog selections the programmer has made for the menu item. The next two #EMBED statements also have ",%Control,%ControlEvent" appended to the end. The first has the HIDE attribute, so it is available only for Code, Control, and Extension template use. These three #EMBEDs give the programmer an embed point both before and after any code automatically generated for them by the Actions tab prompts. #RESUME terminates this #SUSPEND section. #ENDFOR terminates the %Control loop.