Important: The information in this document is obsolete and should not be used for new development.
AppendResMenu
Use theAppendResMenuprocedure 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
AppendResMenuprocedure is also available as theAddResMenuprocedure.
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
AppendResMenufinds.theType- A four-character code that identifies the resource type for which to search.
DESCRIPTION
TheAppendResMenuprocedure 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.AppendResMenuappends the names of found resources in alphabetical order; it does not alphabetize items already in the menu. TheAppendResMenuprocedure does not add resources with names that begin with a period (.) or a percent sign (%) to the menu.The
AppendResMenuprocedure 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
AppendResMenuadd 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
AppendResMenuappend 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,AppendResMenustores information in theitemDefinitionsarray (in theitemIconanditemCmdfields 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
TheAppendResMenuprocedure calls the Resource Manager procedureSetResLoad(specifyingTRUEin theloadparameter) before returning. TheAppendResMenuprocedure 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 callSetResLoadand specifyFALSEin theloadparameter afterAppendResMenureturns.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.