Programming Guide |
Sets a menu item's property
int sm_mnitem_change(int mem_location, char *script, char *menu, int item_no, int prop, int intval, char *strval);int sm_n_mnitem_change(int mem_location, char *script, char *menu, char *item_name, int prop, int intval, char *strval);
mem_location
- The memory location of the item's menu, one of the following constants:
MNL_ANY
MNL_APPLIC
MNL_SCREEN
MNL_FIELDIf you supply
MNL_ANY
, Panther looks for the menu in all memory locations. If the menu is installed in more than one location, the function call fails and returnsMN_ERR_LOCATION
.script
- The name of a memory-resident script that contains the menu to change. The script must already be loaded into memory at
mem_location
by sm_mnscript_load. If you supplyNULL
, Panther searches in the most recently loaded script inmem_location
for the specified menu.menu
- The name of the item's menu, as listed in the Submenu field of the menu bar editor or with the
MENU
keyword in an ASCII menu file. If you supplyNULL
, Panther uses the first menu inscript
.item_no, item_name
- Specifies the menu item to change by its number or name:
sm_mnitem_change
identifies the item by its numeric offset within the menu, where the first menu item is0
.prop
- The property to change, one of the constants listed in Table 5-14.
intval
- The integer value to set for
prop
. If the property takes a string value, supply 0.strval
- The string value to set for
prop
. If the property takes an integer value, supplyNULL
.
sm_mnitem_change
sets the property of a menu item. Menu item properties are derived from a memory-resident script. Becausesm_mnitem_change
changes the specified script, all instances of items from this script get the property change.
Table 5-14 lists menu item property constants and the values you can set these to. Integer and string properties are listed in separate groups.
sm_mnitem_change
andsm_n_mnitem_change
have too many parameters to allow installation by sm_install; consequently, they are not directly accessible to JPL modules. (Refer to "Installing Prototyped Functions" in Application Development Guide for function installation requirements.) A number of wrapper functions that callsm_mnitem_change
andsm_n_mnitem_change
are declared and installed infunclist.c
. You can call these functions from JPL to modify menu items.Table 5-15 lists the provided wrapper functions and their parameter declarations. Each wrapper function is narrowly defined to look for a menu in a discrete memory location—application, screen, or field—or to look in all memory locations (the
change_i_any
andchange_s_any
variants). Also, thechange_i
variants set only integer properties; thechange_s
variants set only string properties. All parameters are identical in type and purpose to those declared forsm_mnitem_change
andsm_n_mnitem_change
.