Introduction to Carbon Event Manager Programming Guide

Events are the foundation of all Carbon programming. Each time the user clicks the mouse, types a character from the keyboard, or chooses a command from a menu, you’re notified by means of an event. When one of your windows needs to be redrawn, moved, or resized, your application receives an event telling you to perform the operation. When your program becomes the active (foreground) application or moves to the background in favor of another, or when another application starts up or quits, you receive an event informing you of the fact. Just about everything a typical Carbon program does, whether interacting with the user or communicating with the system, takes place in response to an event.

The Carbon Event Manager is the preferred interface for handling events in Carbon applications. You can use this interface to handle events generated in response to user input as well as to create your own custom events.

Some of the types of events that the Carbon Event Manager can handle include the following:

The Carbon event model is simpler and more efficient than that used by the Classic Event Manager (sometimes referred to as the WaitNextEvent event model). Many standard responses to events are handled automatically, which means that you need to write code only when you want to override or augment the default actions. In addition, the Carbon Event Manager also provides replacements for custom definition procedure messages.

System Requirements

The Carbon Event Manager is available on Mac OS X (10.0) and later. It is also available on Mac OS 8.6 through Mac OS 9.1 when CarbonLib 1.1.1 or later is installed. Note that some Carbon Event Manager features are available only on later versions of Mac OS X.

Who Should Read This Document

Because event handling is so fundamental to applications, everyone writing Carbon applications should read this document. You should have some familiarity with Macintosh terminology and understand the basics of creating and manipulating the Mac OS user interface (windows, controls, menus, and so on).