GetItem
GetItem Get the text of a menu item void GetItem(theMenu, whichItem, itemString ); MenuHandle theMenu ; handle leading to menu of interest short whichItem ; ID, within theMenu, of item to obtain
Str255 itemString ; receives current text, without meta characters GetItem gets the text of a menu item. It is useful in finding which resource theMenu is a handle leading to a variable-length MenuInfo structure. It is a whichItem identifies an item included in theMenu . Items are numbered
sequentially with the topmost item having an ID of 1; the highest ID
itemString is the address of a buffer. Upon return, it will contain a
length-prefixed pascal-style string of the text in the menu item.
Special metacharacter codes (if any) are not copied to itemString .
Notes: Since you already know the item text for all menus you create, GetItem is typically used for determining the text of menu items inserted in a menu as
The following example creates a "Fonts" menu, installs a list of font
resources, and then removes the "Symbol" font from the menu.
Example
#include <Menus.h>
#define FONT_MENU_ID 131
short fontCount, j;
fontMenu = NewMenu( FONT_MENU_ID, "\pFonts" ); AddResMenu( fontMenu, 'FONT'); /* read in font items */ fontCount=CountMItems( fontMenu ); /* how many there? */ for (j=1; j<=fontCount; j++ ) { /* locate and remove one */
}