Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 3 - Menu Manager / Menu Manager Reference
Menu Manager Routines / Getting and Setting the Appearance of Menu Items


SetItemIcon

Use the SetItemIcon procedure to set the icon number or script code of a specific menu item. Usually you display menu items in the current system script; however, if needed, you can use the SetItemIcon procedure to set the script code of a menu item. For an item's script code to be set, the keyboard equivalent field of the item must contain $1C. If the keyboard equivalent field contains any other value, the SetItemIcon procedure interprets the specified number as the item's icon number.

PROCEDURE SetItemIcon (theMenu: MenuHandle; item: Integer;
                        iconIndex: Byte); 
theMenu
A handle to the menu record of the menu containing the menu item whose icon (or script code) you wish to set.
item
The item number of the menu item. The SetItemIcon procedure sets the icon (or script code) of this item.
iconIndex
If the menu item's keyboard equivalent field does not contain $1C, the SetItemIcon procedure sets the icon number of the item's icon to the number defined in this parameter. The icon number you specify should be a value from 1 through 255 (or from 1 through 254 if the item has a small or reduced icon) or 0 if the item does not have an icon.
The Menu Manager adds 256 to the icon number to generate the resource ID of the 'cicn' or 'ICON' resource that describes the icon of the menu item. For example, if you specify 5 as the value of the iconIndex parameter, when the Menu Manager needs to draw the item, it looks for an icon resource with resource ID 261.
If the menu item's keyboard equivalent field contains $1C, the SetItemIcon procedure sets the script code of the menu item to the number defined in the iconIndex parameter. The Menu Manager displays the menu item using the specified script code if the corresponding script system is installed.
You can specify 0 in the iconIndex parameter to indicate that the item uses the current system script and does not have an icon number.
DESCRIPTION
The SetItemIcon procedure sets the icon number or script code of the specified menu item to the value in the iconIndex parameter.

SEE ALSO
See "Changing the Icon or Script Code of Menu Items" beginning on page 3-62 for examples of setting the icon of a menu item.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996