Programming Guide |
Loads a menu script into memory and makes its menus available for installation
int sm_mnscript_load(int mem_location, char *script);
mem_location
- Specifies where to load this script into memory. You can load a script only once into a given memory location. The script's memory location determines the scope at which its menus can be installed and whether you can install identical instances of the same menu.
MNL_APPLIC
- Loads the menu script into application memory. Menus in application memory can be installed at any scope—application, screen, and field. All instances of a menu installed from application memory are always identical; changes in one are immediately propagated to the others.
MNL_SCREEN
- Loads the menu script into the current screen's memory. Each screen maintains its own memory location. You can install menus for a screen and its widgets from that screen's memory.
MNL_FIELD
- Loads the menu script into the current field's memory. Each field maintains its own memory location. You can install a popup menu for a field from its own memory location.
script
- The name of the menu script to load into memory.
sm_mnscript_load
loads the specified script into application, screen, or field memory. All menus that are defined in that script are subsequently available for installation and display through sm_menu_install.
sm_mnscript_load
lets you load a menu into any memory location that is the same or higher than its caller, as shown in Table 5-18:
Table 5-18 Valid menu script load locations
sm_mnscript_load
callerValid memory locations Application
MNL_APPLIC
Screen
MNL_SCREEN
MNL_APPLICWidget
MNL_FIELD
MNL_SCREEN
MNL_APPLIC
For example, the application's startup routines in
jmain.c
can only load menu scripts into application memory, while a screen's entry procedure can load scripts into application memory and into its own memory.A menu script's memory location determines the scope at which its menus can be installed:
- Application memory menus can be installed at all scopes: application, screen, and field. Instances of a menu installed from application memory all share the same content; changes to one are propagated to all.