Important: The information in this document is obsolete and should not be used for new development.
AppendResMenu
Use theAppendResMenu
procedure to search all resource files open to your application for a given resource type and to append the names of any resources it finds to a specified menu. The specified menu must have been previously created usingNewMenu
,GetMenu
, orGetNewMBar
.The
AppendResMenu
procedure is also available as theAddResMenu
procedure.
PROCEDURE AppendResMenu (theMenu: MenuHandle; theType: ResType);
theMenu
- A handle to the menu record of the menu to which to append the names of any resources of a given type that
AppendResMenu
finds.theType
- A four-character code that identifies the resource type for which to search.
DESCRIPTION
TheAppendResMenu
procedure searches all resource files open to your application for resources of the type defined by the parametertheType
. It appends the names of any resources it finds of the given type to the end of the specified menu.AppendResMenu
appends the names of found resources in alphabetical order; it does not alphabetize items already in the menu. TheAppendResMenu
procedure does not add resources with names that begin with a period (.
) or a percent sign (%
) to the menu.The
AppendResMenu
procedure assigns default characteristics to each menu item. Each appended menu item appears in the menu as an enabled item, without an icon or a mark, in the plain character style, and without a keyboard equivalent. To get the name or to change other characteristics of an item appended byAppendResMenu
, use the Menu Manager routines described in "Getting and Setting the Appearance of Menu Items" beginning on page 3-132.If you specify that
AppendResMenu
add resources of type'DRVR' to your Apple menu, AppendResMenu adds the name (and icon) of each item in the Apple Menu Items folder to the menu.
If you specify that
AppendResMenu
append resources of type'FONT'
or'FOND'
, the Menu Manager performs special processing for any resources it finds that have font numbers greater than $4000. If the script system associated with the font name is installed in the system,AppendResMenu
stores information in theitemDefinitions
array (in theitemIcon
anditemCmd
fields for that item) in the menu's menu record. This allows the Menu Manager to display the font name in the correct script.SPECIAL CONSIDERATIONS
TheAppendResMenu
procedure calls the Resource Manager procedureSetResLoad
(specifyingTRUE
in theload
parameter) before returning. TheAppendResMenu
procedure reads the resource data of the resources it finds into memory. If your application does not want the Resource Manager to read resource data into memory when your application calls other routines that read resources, you need to callSetResLoad
and specifyFALSE
in theload
parameter afterAppendResMenu
returns.SEE ALSO
Listing 3-15 on page 3-69 shows a sample that adds items from the Apple Menu Items folder to the Apple menu, and Listing 3-16 on page 3-70 shows a sample that adds font names to a menu. See Inside Macintosh: More Macintosh Toolbox for information on the Resource Manager.