Handling Apple Events
You do not need to implement all Apple events at once. If you want to begin by supporting only the required Apple events, you must
The following sections explain how to perform these tasks: "Accepting an Apple Event," which begins on page 4-5, "Installing Entries in the Apple Event Dispatch Tables," which begins on page 4-7, and "Handling the Required Apple Events," which begins on page 4-11.
- set bits in the
'SIZE'
resource to indicate that your application supports high-level events- include code to handle high-level events in your main event loop
- write routines that handle the required events
- install entries for the required Apple events in your application's Apple event dispatch table
To respond to the Apple events sent by the Edition Manager in addition to the required events, you must install entries for the Section Read, Section Write, Section Scroll, and Create Publisher events in your application's Apple event dispatch table and write the corresponding handlers, as described in "Handling Apple Events Sent by the Edition Manager" on page 4-20.
To respond to core and functional-area Apple events, you must install entries and write handlers for those events. You must also make sure that your application can locate Apple event objects with the aid of the Apple Event Manager routines described in the chapter "Resolving and Creating Object Specifier Records." These routines are currently available as the Object Support Library (OSL), which you must link with your application when you build it.
The Apple Event Manager (excluding the OSL) is available only in System 7 and later versions of system software. Use the
Gestalt
function with thegestaltAppleEventsAttr
selector to determine whether the Apple Event Manager is available. In theresponse
parameter, the bit defined by the constantgestaltAppleEventsPresent
is set if the Apple Event Manager is available.
CONST gestaltAppleEventsAttr = 'evnt'; {Gestalt selector} gestaltAppleEventsPresent = 0; {if this bit is set, } { then the Apple Event } { Manager is available}To find out which version of the Apple Event Manager is available, you can use theAEManagerInfo
function; for more information, see page 4-104.
Subtopics
- Accepting an Apple Event
- Installing Entries in the Apple Event Dispatch Tables
- Handling the Required Apple Events
- Handling Apple Events Sent by the Edition Manager
- Getting Data Out of an Apple Event
- Writing Apple Event Handlers
- Replying to an Apple Event
- Disposing of Apple Event Data Structures
- Writing and Installing Coercion Handlers