Carbon


EventRecord

Header: Events.h

struct EventRecord {
    EventKind what; 
    UInt32 message; 
    UInt32 when; 
    Point where; 
    EventModifiers modifiers;
};

Field descriptions

what

The kind of event received. The Event Manager specifies the kind of event with one of the values defined by the EventKind enumeration.

message

Additional information associated with the event. The interpretation of this information depends on the event type. The contents of the message field for each event type are summarized here:

when

The when field indicates the time when the event was posted (in ticks since system startup).

where

For low-level events and operating-system events, the where field contains the location of the cursor at the time the event was posted (in global coordinates).

For high-level events, the where field contains a second event specifier, the event ID. The event ID defines the particular type of event within the class of events defined by the message field of the high-level event. For high-level events, you should interpret the where field as having the data type OSType, not Point.

modifiers

The modifiers field contains information about the state of the modifier keys and the mouse button at the time the event was posted. For activate events, this field also indicates whether the window should be activated or deactivated. In System 7 it also indicates whether the mouse-down event caused your application to switch to the foreground.

Each of the modifier keys is represented by a specific bit in the modifiers field of the event structure. The modifier keys include the Option, Command, Caps Lock, Control, and Shift keys. If your application attaches special meaning to any of these keys in combination with other keys or when the mouse button is down, you can test the state of the modifiers field to determine the action your application should take. For example, you can use this information to determine whether the user pressed the Command key and another key to make a menu choice.

When your application uses an Event Manager function to retrieve an event, the Event Manager returns information about the retrieved event in an event structure, which is a structure of type EventRecord.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)