Programming Guide : Writing a Template Assistant : How You Can Write an Assistant
 
Share this page          
How You Can Write an Assistant
In OpenROAD, the developer can associate a 4GL procedure with a frame or field template, which is then referred to as the template's “assistant.” This template, when combined with an assistant procedure, enables the user to create frames and fields that are more powerful and immediately useful than those created from templates alone.
The following specifications for developing an assistant procedure include:
The assistant must be a 4GL procedure. The 4GL procedure itself can, however, subsequently call frames to interact with users.
The 4GL procedure has three parameters, all of which are mandatory.
For frame template assistant procedures, the parameters are:
fs
Parameter Type: FrameSource
Specifies the instance of the frame that is currently being created or modified by the ApplyTemplate utility
return_code
Parameter Type: Integer (ER_OK, ER_FAIL)
Specifies the return code. It is assigned the value ER_OK if the procedure completes successfully; otherwise, it is assigned ER_FAIL.
batch_mode
Parameter Type: Integer (TRUE, FALSE)
Specifies a Boolean parameter telling the frame assistant procedure whether it is being run in batch mode. If TRUE, the procedure cannot depend on any form of user interaction, including calling user frames for user input. If FALSE, the frame assistant can make use of frames for user input.
In the ApplyTemplate utility dialog, selecting the Batch option passes a value of TRUE; and for the Interactive option, FALSE.
For field template assistant procedures, the parameters are:
ff
Parameter Type: FormField
Specifies the instance of the field that is currently being created
return_code
Parameter Type: Integer (ER_OK, ER_FAIL)
Specifies a return code. It is assigned the value ER_OK if the procedure has completed successfully; otherwise, it is assigned ER_FAIL.
batch_mode
Parameter Type: Integer (TRUE, FALSE)
Specifies a Boolean parameter telling the field assistant procedure whether it is being run in batch mode. If TRUE, the procedure cannot depend on any form of user interaction, including calling user frames for user input. If FALSE, the field assistant can make use of frames for user input.
In the ApplyTemplate utility, selecting the Batch option passes a value of TRUE; and for the Interactive option, FALSE.
The following sections present examples of frame and field template assistants.