Workbench User Guide : Writing Scripts and Procedures : How Field and Menu Scripts Work
 
Share this page          
How Field and Menu Scripts Work
A field script or menu script contains the code for a single field or menu item, respectively, such as a radio field or a menu toggle. Field and menu scripts can contain initialization code, event blocks and local procedures.
The initialize statements in field and menu scripts differ from those used in the frame script in that they contain no parameter declarations. A field's initialize block is executed during frame start-up, following the execution of the initialize block for the frame and preceding execution of the initialize block for any ancestors.
Because field scripts are associated directly with a field or menu item, it is not necessary to name the field or menu item in the event block. To call the editor, select the field or menu item, and then click Edit, Field Script in the Frame Editor or the Menu Editor. You can also code the field and menu scripts in the frame script.
Whether you include the code for an individual field or menu item in the frame script or in a field script is basically a matter of your personal preference or programming style. Putting all the code for the fields in the frame script lets you centralize the code for the frame. Using individual field scripts means that the script is permanently associated with the specific field or menu item if you copy or duplicate the field.
For more information about writing field and menu scripts, see the Programming Guide.