Appendix B. Carbon Event Classesand Kinds

In order to handle events, you need to tell the Carbon Event Manager what kinds of events you want to be notified about. You do so by specifying the class and kind of each event you want to handle. Table 2.1 through Table 2.9 list the most common event classes and kinds. After you’ve identified the event class (keyboard, mouse, and so forth) and the event kind (mouse up, mouse down, and so on) appropriate to your application’s needs, you pass these to the Carbon Event Manager when installing your event handler. See Chapter 6 for more information.

Table B-1. Event Kinds in the Application Event Class (kEventClassApplication)

Event KindMeans
kEventAppActivated This application brought to foreground
kEventAppDeactivated This application sent to background
kEventAppFrontSwitched Frontmost (active) application changed
kEventAppLaunched Another application started up
kEventAppTerminated Another application terminated
kEventAppQuit This application about to be terminated

Table B-2. Event Kinds in the Command Event Class (kEventClassCommand)

Event KindMeans
kEventCommandProcess Menu item chosen or a control with a command that has been pressed
kEventCommandUpdateStatus Determine enabled or disabled status of command

Table B-3. Event Kinds in the Control Event Class (kEventClassControl)

Event KindMeans
kEventControlDefInitialize Control created
kEventControlDefDispose Control to be destroyed
kEventControlHit Mouse button pressed in control
kEventControlSimulateHit ...

Get Learning Carbon now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.