Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 2 - Event Manager


Using the Event Manager

You can use the Event Manager to receive information about hardware-related events, about changes in the appearance of your application's windows, or about changes in
the operating status of your application. You can also use the Event Manager to communicate directly with other applications. This communication can include sending events to other applications, receiving events from other applications, and searching for specific events from other applications.

Your application can both send and receive high-level events, but it generally only receives low-level events and should not send them. Your application receives low-level events, operating-system events, and high-level events in the same way, which is by asking the Event Manager for the next available event. If the event your application receives is a high-level event, your application might need to use another Event Manager or Apple Event Manager routine to retrieve an optional data buffer and additional information accompanying that event.

Before using the Event Manager, you can use the Gestalt function to determine if certain features of the Event Manager are available. See the chapter "Gestalt Manager" in Inside Macintosh: Operating System Utilities for information on the Gestalt function.

If your application sends or receives high-level events, you should use the Gestalt function with the gestaltPPCToolboxAttr selector to determine whether the PPC Toolbox is present. Use the Gestalt function with the gestaltOSAttr selector to see if the Process Manager is available. If the PPC Toolbox and the Process Manager are present, then the system software provides support for high-level events.

If your application sends or receives Apple events, use the Gestalt function with the gestaltAppleEventsAttr selector to determine whether the Apple Event Manager
is available.

Your application needs to initialize QuickDraw, the Font Manager, and the Window Manager before using the Event Manager. Your application can accomplish this initialization by using the InitGraf, InitFonts, and InitWindows procedures.

When your application starts, you can call the FlushEvents procedure to empty
the Operating System event queue of any low-level events left unprocessed by
another application. For example, you might want to remove any mouse-down
events or keyboard events that the user might have entered while the Finder launched your application.

This section shows how to retrieve events from the Event Manager, how to mask out unwanted events, how to specify memory and scheduling options for your application, and how to handle each type of event received from the Event Manager.


Subtopics
Obtaining Information About Events
Processing Events
Creating a Size Resource
Handling Low-Level Events
Handling Operating-System Events
Handling High-Level Events

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996