Microsoft KB Archive/58824

From BetaArchive Wiki
Knowledge Base


How to Use Apple Symbol in Menus; Create Custom Apple Menu

Article ID: 58824

Article Last Modified on 11/21/2006

This article was previously published under Q58824

SUMMARY

This article demonstrates how to use the Apple symbol and other special characters in menus. By disabling the standard Apple menu, it is possible to create your own application Apple menu. This facility gives more control to QuickBASIC programs.

This information applies to Microsoft QuickBASIC Version 1.00 for the Apple Macintosh.

MORE INFORMATION

The following code example disables the Apple menu and creates a menu bar containing new Apple, File, and Edit menus. It then creates menus using each of the special low-order ASCII characters (17-20), and finally, it makes menu items using all the displayable extended-ASCII characters.

toolbox "i"

'Erase menu bar
toolbox "pq", &HA934

'Set up 3 new standard menus :
MENU 1, 0, 1, CHR$(20)       'Apple symbol=CHR$(20)
MENU 2, 0, 1, "File"
MENU 3, 0, 1, "Edit"

'Set four other menus using special characters
FOR i% = 17 TO 20
    MENU i%-13, 0, 1, CHR$(i%)+STR$(i%)
NEXT

'Set menu items to show usable extended characters
FOR i% = 1 TO 6
    FOR j% = 1 TO 15
        n% = 127+((i%-1)*15)+j%
        MENU i%+1, j%, 1, CHR$(n%)+STR$(n%)
    NEXT
NEXT

'Wait for a mouse click to end program
WHILE MOUSE(0)<>1 : WEND
                

NOTE: This program does not process any menu events, and thus lacks full functionality. Detecting which menu option is chosen must be done using ON MENU GOSUB event trapping or polling of the MENU() function.

For users of the Macintosh II computer, the above program even uses the color Apple in the first menu. The limitation to using color with the apple is that the menu title must be one character wide and the color icon (cicn resource), id=20, must be defined in the System file. This can be checked with ResEdit by doing the following:

  1. Start ResEdit.
  2. Open the System file.
  3. Open the "cicn" resource.
  4. Verify that there is a resource with ID=20.



Additional query words: MQuickB

Keywords: KB58824