Programming Guide



sm_*mnitem_create

Inserts a new item into a menu

int sm_mnitem_create(int mem_location, char *script, char *menu, int next_item_no, int item_type, char *item_name);
int sm_n_mnitem_create(int mem_location, char *script, char *menu, char *next_item_name, int item_type, char *item_name);

mem_location
The memory location of the item's menu, one of the following constants:
MNL_APPLIC
MNL_SCREEN
MNL_FIELD

script
The name of a memory-resident script that contains the item's menu. The script must already be loaded into memory at mem_location by sm_mnscript_load. If you supply NULL, Panther searches in the most recently loaded script in mem_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 supply NULL, Panther uses the first menu in script.

next_item_no, next_item_name
Specifies the new item's position by the number or name of the item to follow it:

item_type
The item's type. Supply one of the constants described in Table 5-14.

item_name
The name to assign this item. Item names must be unique within the same menu. Supply NULL to create an unnamed item.

Environment

C only

Returns

Description

sm_mnitem_create inserts a new menu item into a menu. After you create this item, you can set its properties through sm_mnitem_change. The menu displays this item at the next delayed write.

Table 5-14 lists menu item type constants.

Table 5-14 Menu item type constants

Item type constants Item behavior

MI_SEPARATOR

Draws a separator between the previous and next menu items, according to the specified separator style MNI_SEP_STYLE).

MI_SUBMENU

Invokes another menu. If a MI_SUBMENU-type item is on the menu bar, its submenu displays as a pulldown; otherwise, the submenu displays to its right.

MI_ACTION_BTTN

Invokes an action through a control string.

MI_TOGGLE_BTTN

Invokes an action through a control string and toggles the indicator on or off.

MT_WINDOWS_OPT

Invokes the windows menu of the current platform—for example, under Windows, the Windows menu with Arrange Icons, Tile, and Cascade. This item is ignored in character mode.

MT_WINDOWS_LIST

Invokes a menu that lists all open windows.

MT_EDIT_CUT*

Cuts selected text to the clipboard.

MT_EDIT_DELETE*

Deletes the selected text.

MT_EDIT_PASTE*

Pastes the clipboard contents.

MT_EDIT_SELECT*

Selects the current widget's contents.

MT_EDIT_COPY*

Copies selected text to the clipboard.

MT_EDIT_CLEAR*

Replaces the selected text with blank spaces.

*Under Windows and Motif, use edit-type items only on a pulldown or popup menu. Windows and Motif inactivate edit-type menu items when they appear on a menu bar.