ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Q How do I create a menu with an icon as its title, such as AppleScript(TM) and
other products use? A The menu data for the menu title must be 0x0501<handle> where <handle> is replaced by the the results of calling GetIconSuite(). An example snippet of code follows. This snippet assumes that the menu title is already 5 bytes long. void ChangeToIconMenu() { Handle theIconSuite = nil; MenuHandle menuHandle; GetIconSuite(&theIconSuite, cIcon, svAllSmallData); if (theIconSuite) { menuHandle = GetMenuHandle(mIcon); if (menuHandle) { // second byte must be a 1, followed by the icon suite handle (**menuHandle).menuData[1] = 0x01; *((long *)&((**menuHandle).menuData[2])) = (long)theIconSuite; // update display (typically you do this on startup) DeleteMenu(mIcon); InsertMenu(menuHandle, 0); InvalMenuBar(); } } } [May 01 1995] |
|