Previous Book Contents Book Index Next

Inside Macintosh: Programmer's Guide to MacApp / Part 2 - Working With MacApp

Chapter 13 -
Working With Events and Commands

This chapter provides recipes and sample code that demonstrate how to

For an overview of event handling in MacApp, see Chapter 1, "MacApp Overview."

For a detailed description of event dispatching and the use of command objects to respond to events, see Chapter 5, "Events and Commands."

For a description of Apple event dispatching, see Chapter 6, "Scripting."

For information on working with Apple events, see Chapter 14, "Working With Scripting."

Chapter Contents
Which Object Should Handle an Event or Menu Command
Working With Behaviors
Recipes--Events and Commands
Creating a Command Object to Perform an Action--A General Overview
Recipe--Implementing an Undoable Zoom In Menu Command
Define a Command-Number Constant for the Zoom In Menu Item
Add the Zoom In Menu Item to a 'CMNU' Resource
Implement a Command Class That Handles Zoom In
The IZoomInCommand Method
The DoIt Method
The RedoIt Method
The UndoIt Method
Override DoSetupMenus in the View Class
Override DoMenuCommand in the Document Class
Recipe--Changing the Current Target Object and Performing Validation
Changing the Current Target Object
Performing Validation When a Target Change Is Attempted
Recipe--Ensuring Idle Time for an Event-Handler Object
Override the DoIdle Method
Install the Object in the Cohandler Chain
Set the fIdleFreq Field to Specify How Often DoIdle Should Be Called
Remove the Object From the Cohandler Chain
Recipe--Using a Behavior Object to Implement Alphabetic Type-Ahead
Define a View Class That Descends From TTextListView
Add a TKeySelectionBehavior Behavior to the View Object

Previous Book Contents Book Index Next

© Apple Computer, Inc.
25 JUL 1996