Important: The information in this document is obsolete and should not be used for new development.
Chapter 12 -
This chapter describes how to specify menus and menu items for your application, and how to handle the events that result from user menu choices. It includes recipes and sample code that demonstrate how to
Working With Menus
For information on MacApp's command-handling mechanism, including the MacApp Menu Manager and its command-numbering system, see Chapter 5, "Events and Commands."
- work with menus (a general outline)
- add a command to a menu, enable it, and respond to it
- use a hierarchical menu
- create a pop-up menu from a resource template
- add a menu item to the help menu
Chapter Contents
- Overview
- Working With Menu Resources
- MacApp Menu ID Constants
- The Menu Bar Manager
- The 'MBAR' Resource
- Defining Menu Contents With a 'CMNU' Resource
- The Buzzwords 'CMNU' Resource
- Enabling and Disabling Menu Items
- Processing a Menu Choice
- Changing Menus From Your Application
- Working With Pop-Up Menus
- The TPopup Class
- Responding to a User Menu Choice
- Recipes--Menus
- Working With Menus--A General Outline
- Recipe--Adding, Enabling, and Responding to a Menu Command
- Define a Command-Number Constant for the Menu Item
- Add the Menu Command to the 'CMNU' Resource
- Enable the Menu Command in a DoSetupMenus Method
- Respond to the Menu Command in a DoMenuCommand Method
- Recipe--Using a Hierarchical Menu
- Define Constants for the Hierarchical Menu and Menu Items
- Define a Menu-Bar Resource That Includes Your Hierarchical Menu
- Define a Menu-Bar Resource With Your Menu Items
- Define a 'CMNU' Resource for Your Hierarchical Menu
- Define a 'CMNU' Resource for Each Submenu
- Enable Hierarchical Menu Items in a DoSetupMenus Method
- Respond to Hierarchical Menu Choices in a DoMenuCommand Method
- Recipe--Creating a Pop-up Menu From a Resource Template
- Define a Menu-Number Constant for the Pop-up Menu
- Define Command-Number Constants for the Pop-up Menu Items
- Define a 'CMNU' Resource for the Pop-up
- Define a 'View' Resource for the View to Contain the Pop-up
- Use the Global View Server Object to Create the Pop-up
- Recipe--Adding an Item to the Help Menu
- Define a Command-Number Constant
- Override AddHelpMenuItems in Your Application Class
- Override DoMenuCommand