NSEvent Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSEvent.h
NSTouch.h
Related sample code

Overview

An NSEvent object, or simply an event, contains information about an input action such as a mouse click or a key down. The Application Kit associates each such user action with a window, reporting the event to the application that created the window. The NSEvent object contains pertinent information about each event, such as where the cursor was located or which character was typed. As the application receives events, it temporarily places them in a buffer called the event queue. When the application is ready to process an event, it takes one from the queue.

Beginning with OS X version 10.4, NSEvent objects can represent tablet-pointing and tablet-proximity events. A tablet-proximity event is generated when a pointing device enters or leaves proximity of its tablet; such event objects have a type of NSTypeProximity or a mouse subtype of NSTabletProximityEventSubtype. A tablet-pointing event is generated when a pointing device changes state, such as location, pressure, or tilt; such event objects have a type of NSTypePoint or a mouse subtype of NSTabletPointEventSubtype. The Application Kit reports all pure tablet events to responder objects through the NSResponder methods tabletPoint: and tabletProximity:. Mouse events can also contain tablet data (as event subtypes), so you can handle these events by overriding the NSResponder methods mouseDown:, mouseDragged:, and mouseUp:.

Support for touch and gesture events masks have been added to NSEvent in OS X v10.6. Magnify (pinch), swipe, and rotate masks are supported, as are more generic gesture masks. Using touchesMatchingPhase:inView: method a view can get all of the touch events associated with a gesture without overriding the individual touch responder methods defined in NSResponder.

OS X v10.6 adds the ability to create application event monitors that call block object handlers for certain event types that are sent through the NSApplication sendEvent: method. You can create a local monitor that will be informed of the events in your application and allow you to modify or cancel them. You can also create a global event monitor that allows you to monitor events in other applications, although you are unable to alter those events. See “Monitoring Application Events” for more information.

Tasks

Creating Events

Getting General Event Information

Getting Key Event Information

Getting Mouse Event Information

Getting Mouse-Tracking Event Information

Getting Custom Event Information

Getting Scroll Wheel Event Information

Getting Tablet Proximity Information

Getting Tablet Pointing Information

Requesting and Stopping Periodic Events

Getting Touch and Gesture Information

Monitoring Application Events

Scroll Wheel and Flick Events

Class Methods

addGlobalMonitorForEventsMatchingMask:handler:

Installs an event monitor that receives copies of events posted to other applications.

+ (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(void (^)(NSEvent*))block
Parameters
mask

An event mask specifying which events you wish to monitor. See “NSEventMaskFromType” for possible values.

block

The event handler block object. It is passed the event to monitor. You are unable to change the event, merely observe it.

Return Value

An event handler object.

Discussion

Events are delivered asynchronously to your app and you can only observe the event; you cannot modify or otherwise prevent the event from being delivered to its original target application.

Key-related events may only be monitored if accessibility is enabled or if your application is trusted for accessibility access (see AXIsProcessTrusted).

Note that your handler will not be called for events that are sent to your own application.

Special Considerations

In OS X v 10.6, event monitors are only able to monitor the following event types:

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

addLocalMonitorForEventsMatchingMask:handler:

Installs an event monitor that receives copies of events posted to this application before they are dispatched.

+ (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* (^)(NSEvent*))block
Parameters
mask

An event mask specifying which events you wish to monitor. See “NSEventMaskFromType” for possible values.

block

The event handler block object. It is passed the event to monitor. You can return the event unmodified, create and return a new NSEvent object, or return nil to stop the dispatching of the event.

Return Value

An event handler object.

Discussion

Your handler will not be called for events that are consumed by nested event-tracking loops such as control tracking, menu tracking, or window dragging; only events that are dispatched through the applications sendEvent: method will be passed to your handler.

Special Considerations

In OS X v 10.6, event monitors are only able to monitor the following event types:

Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
NSEvent.h

doubleClickInterval

Returns the time, in seconds, in which a second mouse click must occur in order to be considered a double click.

+ (NSTimeInterval)doubleClickInterval
Return Value

The double-click time interval, in seconds.

Discussion

This is a system setting, overriding this method will have no effect.

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:

Returns a new NSEvent object describing a tracking-rectangle or cursor-update event.

+ (NSEvent *)enterExitEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSUInteger)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)windowNumber context:(NSGraphicsContext *)context eventNumber:(NSInteger)eventNumber trackingNumber:(NSInteger)trackingNumber userData:(void *)userData
Parameters
type

One of the following event-type constants: NSMouseEntered, NSMouseExited, NSCursorUpdate. If the specified constant is not one of these, an NSInternalInconsistencyException is raised

location

The cursor location in the base coordinate system of the window specified by windowNum.

flags

An integer bit field containing any of the modifier key masks described in “Constants,” combined using the C bitwise OR operator.

time

The time the event occurred in seconds since system startup.

windowNum

An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.

context

The display graphics context of the event.

eventNumber

An identifier for the new event. It’s normally taken from a counter for mouse events, which continually increases as the application runs.

trackingNumber

A number that identifies the tracking rectangle. This identifier is the same as that returned by the NSView method addTrackingRect:owner:userData:assumeInside:.

userData

Data arbitrarily associated with the tracking rectangle when it was set up using the NSView method addTrackingRect:owner:userData:assumeInside:.

Return Value

The created NSEvent object or nil if the object could not be created.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

eventWithCGEvent:

Creates and returns an event object that is based on a Core Graphics type of event.

+ (NSEvent *)eventWithCGEvent:(CGEventRef)cgEvent
Parameters
cgEvent

A CGEventRef opaque type that represents an event.

Return Value

An autoreleased NSEvent object that is equivalent to cgEvent.

Discussion

The returned object retains the CGEventRef object (cgEvent) until it (the Objective-C object) is freed—it then releases the CGEventRef object. If no Cocoa event corresponds to the CGEventRef object, this method returns nil.

Availability
  • Available in OS X v10.5 and later.
See Also
Declared In
NSEvent.h

eventWithEventRef:

Creates an event object that is based on a Carbon type of event.

+ (NSEvent *)eventWithEventRef:(const void *)eventRef
Parameters
eventRef

The EventRef opaque type to be associated with the created NSEvent object.

Return Value

An autoreleased NSEvent object corresponding to eventRef or nil if eventRef cannot be converted into an equivalent NSEvent object.

Discussion

This method is valid for all events. The created NSEvent object retains the EventRef object and is released when the NSEvent object is freed.

Availability
  • Available in OS X v10.5 and later.
See Also
Declared In
NSEvent.h

isMouseCoalescingEnabled

Indicates whether mouse-movement event coalescing is enabled.

+ (BOOL)isMouseCoalescingEnabled
Return Value

YES if mouse-movement event coalescing is enabled, NO if it is disabled.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

isSwipeTrackingFromScrollEventsEnabled

Returns the user's preference about using gesture scrolls as a way to track fluid swipes.

+ (BOOL)isSwipeTrackingFromScrollEventsEnabled
Return Value

YES if swipe tracking for scroll events is enable; otherwise NO.

Discussion

This value is determined by the mouse and trackpad preferences for the current user.

Generally, an NSScrollView instance will check this for you. However, if your app is not using an NSScrollView object, or an NSResponder instance can receive NSScrollWheel messages without first being sent to a scroll view , then you should check this preference before invoking trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:

Returns a new NSEvent object describing a key event.

+ (NSEvent *)keyEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSUInteger)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)windowNum context:(NSGraphicsContext *)context characters:(NSString *)characters charactersIgnoringModifiers:(NSString *)unmodCharacters isARepeat:(BOOL)repeatKey keyCode:(unsigned short)code
Parameters
type

One of the following event-type constants: NSKeyDown, NSKeyUp, NSFlagsChanged. If anything else is specified, an NSInternalInconsistencyException is raised.

location

The cursor location in the base coordinate system of the window specified by windowNum.

flags

An integer bit field containing any of the modifier key masks described in “Constants,” combined using the C bitwise OR operator.

time

The time the event occurred in seconds since system startup.

windowNum

An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.

context

The display graphics context of the event.

characters

A string of characters associated with the key event. Though most key events contain only one character, it is possible for a single keypress to generate a series of characters.

unmodCharacters

The string of characters generated by the key event as if no modifier key had been pressed (except for Shift). This argument is useful for getting the “basic” key value in a hardware-independent manner.

repeatKey

YES if the key event is a repeat caused by the user holding the key down, NO if the key event is new.

code

A number that identifies the keyboard key associated with the key event. Its value is hardware-independent.

Return Value

The created NSEvent instance or nil if the instance could not be created.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

keyRepeatDelay

Returns the length of time a key must be held down in order to generate the first key repeat event.

+ (NSTimeInterval)keyRepeatDelay
Return Value

The delay interval, in seconds.

Discussion

This is a system setting, overriding this method will have no effect.

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

keyRepeatInterval

Returns the length between subsequent key repeat events being posted.

+ (NSTimeInterval)keyRepeatInterval
Return Value

The repeat interval, in seconds.

Discussion

This is a system setting, overriding this method will have no effect.

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

modifierFlags

Returns the currently pressed modifier flags.

+ (NSUInteger)modifierFlags
Return Value

A mask of the current modifiers using the values in “Modifier Flags.”

Discussion

This returns the state of devices combined with synthesized events at the moment, independent of which events have been delivered via the event stream.

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:

Returns a new NSEvent object describing a mouse-down, -up, -moved, or -dragged event.

+ (NSEvent *)mouseEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSUInteger)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)windowNum context:(NSGraphicsContext *)context eventNumber:(NSInteger)eventNumber clickCount:(NSInteger)clickNumber pressure:(float)pressure
Parameters
type

One of the modifier key masks described in “NSEventType,” or an NSInternalInconsistencyException is raised.

location

The cursor location in the base coordinate system of the window specified by windowNum.

flags

An integer bit field containing any of the modifier key masks described in “Constants,” combined using the C bitwise OR operator.

time

The time the event occurred in seconds since system startup.

windowNum

An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.

context

The display graphics context of the event.

eventNumber

An identifier for the new event. It’s normally taken from a counter for mouse events, which continually increases as the application runs.

clickNumber

The number of mouse clicks associated with the mouse event.

pressure

A value from 0.0 to 1.0 indicating the pressure applied to the input device on a mouse event, used for an appropriate device such as a graphics tablet. For devices that aren’t pressure-sensitive, the value should be either 0.0 or 1.0.

Return Value

The created NSEvent instance or nil if the instance could not be created.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

mouseLocation

Reports the current mouse position in screen coordinates.

+ (NSPoint)mouseLocation
Return Value

The current mouse location in screen coordinates.

Discussion

This method is similar to the NSWindow method mouseLocationOutsideOfEventStream. It returns the location regardless of the current event or pending events. The difference between these methods is that mouseLocationOutsideOfEventStream returns a point in the receiving window’s coordinates and mouseLocation returns the same information in screen coordinates.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:

Returns a new NSEvent object describing a custom event.

+ (NSEvent *)otherEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSUInteger)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)windowNum context:(NSGraphicsContext *)context subtype:(short)subtype data1:(NSInteger)data1 data2:(NSInteger)data2
Parameters
type

One of the following event-type constants:

If type is anything else, an NSInternalInconsistencyException is raised. Your code should only create events of type NSApplicationDefined.

location

The cursor location in the base coordinate system of the window specified by windowNum.

flags

An integer bit field containing any of the modifier key masks described in “Constants,” combined using the C bitwise OR operator.

time

The time the event occurred in seconds since system startup.

windowNum

An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.

context

The display graphics context of the event.

subtype

A numeric identifier that further differentiates custom events of types NSAppKitDefined, NSSystemDefined, and NSApplicationDefined. NSPeriodic events don’t use this attribute.

data1

Additional data associated with the event. NSPeriodic events don’t use these attributes.

data2

Additional data associated with the event. NSPeriodic events don’t use these attributes.

Return Value

The created NSEvent object or nil if the object couldn't be created.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

pressedMouseButtons

Returns the indices of the currently depressed mouse buttons.

+ (NSUInteger)pressedMouseButtons
Return Value

The indices of the currently depressed mouse buttons.

Discussion

A return value of 1 << 0 corresponds to the left mouse button, 1 << 1 corresponds to the right mouse button, 1<< n, n >=2 correspond to other mouse buttons.

This returns the state of devices combined with synthesized events at the moment, independent of which events have been delivered via the event stream, so this method is not suitable for tracking.

Availability
  • Available in OS X v10.6 and later.
Declared In
NSEvent.h

removeMonitor:

Remove the specified event monitor.

+ (void)removeMonitor:(id)eventMonitor
Parameters
eventMonitor

The event handler object to remove.

Discussion

You must ensure that eventMonitor is removed only once. Removing the same eventMonitor instance multiple times results in an over-release condition, even in a Garbage Collected environment

Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
NSEvent.h

setMouseCoalescingEnabled:

Controls whether mouse-movement event coalescing is enabled.

+ (void)setMouseCoalescingEnabled:(BOOL)flag
Parameters
flag

YES to enable mouse-movement event coalescing, NO to disable it.

Discussion

This method affects mouse-moved, mouse-dragged, and tablet events. Mouse-movement event coalescing is enabled by default.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

startPeriodicEventsAfterDelay:withPeriod:

Begins generating periodic events for the current thread.

+ (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySeconds withPeriod:(NSTimeInterval)periodSeconds
Parameters
delaySeconds

The number of seconds that NSEvent should wait before beginning to generate periodic events.

periodSeconds

The period in seconds between the generated events.

Discussion

Raises an NSInternalInconsistencyException if periodic events are already being generated for the current thread. This method is typically used in a modal loop while tracking mouse-dragged events.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSEvent.h

stopPeriodicEvents

Stops generating periodic events for the current thread and discards any periodic events remaining in the queue.

+ (void)stopPeriodicEvents
Discussion

This message is ignored if periodic events aren’t currently being generated.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSEvent.h

Instance Methods

absoluteX

Reports the absolute x coordinate of a pointing device on its tablet at full tablet resolution.

- (NSInteger)absoluteX
Discussion

For the coordinate to be valid, the receiver should represent an event generated by a tablet pointing device (otherwise 0 is returned). This method is valid only for mouse events with a subtype of NSTabletPointEventSubtype and for events of type NSTabletPoint. Use this value if you want to scale from tablet location to screen location yourself; otherwise use the class method mouseLocation or the instance method locationInWindow.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

absoluteY

Reports the absolute y coordinate of a pointing device on its tablet at full tablet resolution.

- (NSInteger)absoluteY
Discussion

For the coordinate to be valid, the receiver should represent an event generated by a tablet pointing device (otherwise 0 is returned). This method is valid only for mouse events with a subtype of NSTabletPointEventSubtype and for events of type NSTabletPoint. Use this value if you want to scale from tablet location to screen location yourself; otherwise use the class method mouseLocation or the instance method locationInWindow.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

absoluteZ

Reports the absolute z coordinate of pointing device on its tablet at full tablet resolution.

- (NSInteger)absoluteZ
Discussion

For the coordinate to be valid, the receiver should represent an event generated by a tablet pointing device (otherwise 0 is returned). The z coordinate does not represent pressure. It registers the depth coordinate returned by some tablet devices with wheels; if the device is something other than these, 0 is returned. This method is valid only for mouse events with a subtype of NSTabletPointEventSubtype and for events of type NSTabletPoint.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

buttonMask

Returns a bit mask identifying the buttons pressed when the tablet event represented by the receiver was generated.

- (NSUInteger)buttonMask
Discussion

Use one or more of the button-mask constants described in “Constants” to determine which buttons of the pointing device are pressed. This method is valid only for mouse events with a subtype of NSTabletPointEventSubtype and for events of type NSTabletPoint.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

buttonNumber

Returns the button number for the mouse button that generated an NSOtherMouse... event.

- (NSInteger)buttonNumber
Discussion

This method is intended for use with the NSOtherMouseDown, NSOtherMouseUp, and NSOtherMouseDragged events, but will return values for NSLeftMouse... and NSRightMouse... events also.

Availability
  • Available in OS X v10.1 and later.
Declared In
NSEvent.h

capabilityMask

Returns a mask whose set bits indicate the capabilities of the tablet device that generated the event represented by the receiver.

- (NSUInteger)capabilityMask
Discussion

These bits are vendor-defined. This method is valid only for mouse events with a subtype of NSTabletProximityEventSubtype and for events of type NSTabletProximity.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

CGEvent

Returns a Core Graphics event object corresponding to the receiver.

- (CGEventRef)CGEvent
Discussion

The returned CGEventRef opaque type is autoreleased. If no CGEventRef object corresponding to the NSEvent object can be created, this method returns NULL.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

characters

Returns the characters associated with the receiving key-up or key-down event.

- (NSString *)characters
Discussion

These characters are derived from a keyboard mapping that associates various key combinations with Unicode characters. Raises an NSInternalInconsistencyException if sent to any other kind of event object.

This method returns an empty string for dead keys, such as Option-e. However, for a key combination such as Option-Shift-e this method returns the standard accent ("´").

For a list of constants corresponding to commonly-used Unicode characters, see NSText Class Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

charactersIgnoringModifiers

Returns the characters generated by the receiving key event as if no modifier key (except for Shift) applies.

- (NSString *)charactersIgnoringModifiers
Discussion

Raises an NSInternalInconsistencyException if sent to a non-key event.

This method returns the non-modifier key character pressed for dead keys, such as Option-e. For example, Option-e (no shift key) returns an “e" for this method, whereas the characters method returns an empty string.

This method is useful for determining “basic” key values in a hardware-independent manner, enabling such features as keyboard equivalents defined in terms of modifier keys plus character keys. For example, to determine if the user typed Alt-S, you don’t have to know whether Alt-S generates a German double ess, an integral sign, or a section symbol. You simply examine the string returned by this method along with the event’s modifier flags, checking for “s” and NSAlternateKeyMask.

For a list of constants corresponding to commonly-used Unicode characters, see NSText Class Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

clickCount

Returns the number of mouse clicks associated with the receiver, which represents a mouse-down or mouse-up event.

- (NSInteger)clickCount
Discussion

Raises an NSInternalInconsistencyException if sent to a non-mouse event.

Returns 0 for a mouse-up event if a time threshold has passed since the corresponding mouse-down event. This is because if this time threshold passes before the mouse button is released, it is no longer considered a mouse click, but a mouse-down event followed by a mouse-up event.

The return value of this method is meaningless for events other than mouse-down or mouse-up events.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

context

Returns the display graphics context of the receiver.

- (NSGraphicsContext *)context
Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

data1

Returns additional data associated with the receiver.

- (NSInteger)data1
Discussion

The value returned by this method is dependent on the event type, and is defined by the originator of the event. Raises an NSInternalInconsistencyException if sent to an event not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, or NSPeriodic.

NSPeriodic events don’t use this attribute.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

data2

Returns additional data associated with the receiver.

- (NSInteger)data2
Discussion

The value returned by this method is dependent on the event type, and is defined by the originator of the event. Raises an NSInternalInconsistencyException if sent to an event not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, or NSPeriodic.

NSPeriodic events don’t use this attribute.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

deltaX

Returns the x-coordinate change for a scroll wheel, mouse-move, or mouse-drag event.

- (CGFloat)deltaX
Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

deltaY

Returns the y-coordinate change for a scroll wheel, mouse-move, or mouse-drag event.

- (CGFloat)deltaY
Discussion

The behavior of this method may seem counter-intuitive: as the mouse moves up the screen, the value is negative; and as it moves down the screen, the value is positive. The reason for this behavior is that NSEvent computes this delta value in device space, which is flipped, but both the screen and the window’s base coordinate system are not flipped.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

deltaZ

Returns the z-coordinate change for a scroll wheel, mouse-move, or mouse-drag event.

- (CGFloat)deltaZ
Discussion

This value is typically 0.0.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSEvent.h

deviceID

Returns a special identifier that is used to match tablet-pointer events with the tablet-proximity event represented by the receiver.

- (NSUInteger)deviceID
Discussion

All tablet-pointer events generated in the period between the device entering and leaving tablet proximity have the same device ID. This message is valid only for mouse events with subtype NSTabletPointEventSubtype or NSTabletProximityEventSubtype, and for NSTabletPoint and NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

eventNumber

Returns the counter value of the latest mouse or tracking-rectangle event object; every system-generated mouse and tracking-rectangle event increments this counter.

- (NSInteger)eventNumber
Discussion

Raises an NSInternalInconsistencyException if sent to any other type of event object.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

eventRef

Returns the Carbon type associated with the receiver for representing an event.

- (const void *)eventRef
Return Value

Returns an EventRef opaque type corresponding to the receiver. User-input events typically are created with an associated EventRef. An NSEvent object created through other means creates an EventRef in this method if that is necessary and possible. If there is no equivalent NSEvent for the receiver, this method returns NULL.

Discussion

This method is valid for all types of events. The EventRef object is retained by the receiver, so it is valid as long as the NSEvent object is valid, and is released when the NSEvent object is freed. You can use RetainEvent to extend the lifetime of the EventRef object, with a corresponding ReleaseEvent when you are done with it.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

hasPreciseScrollingDeltas

Returns whether there are precise scrolling deltas available.

- (BOOL)hasPreciseScrollingDeltas
Return Value

YES if precise scrolling deltas are available; NO otherwise.

Discussion

This method is valid for NSScrollWheel events. A generic scroll wheel issues rather coarse scroll deltas. Some mice and trackpads provide much more precise delta. This method determines how the values of the scrollingDeltaX and scrollingDeltaY should be interpreted.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

isARepeat

Returns YES if the receiving key event is a repeat caused by the user holding the key down, NO if the key event is new.

- (BOOL)isARepeat
Discussion

Raises an NSInternalInconsistencyException if sent to an NSFlagsChanged event or other non-key event.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

isDirectionInvertedFromDevice

Returns whether the user has changed the device inversion.

- (BOOL)isDirectionInvertedFromDevice
Return Value

Returns YES if the direction is inverted; NO otherwise.

Discussion

This method valid for NSEventScrollWheel and NSEventTypeSwipe events. The user may choose to change the scrolling behavior such that it feels like they are moving the content instead of the scroll bar.

To accomplish this, deltaX and deltaY and scrollingDeltaX and scrollingDeltaY values are automatically inverted for NSEventScrollWheel events according to the user's preferences.

The direction of fluid swipes matches the direction of scrolling and as such for NSEventTypeSwipe events gestureAmount is inverted. However, for some uses of NSEventScrollWheel and NSEventTypeSwipe events, the behavior should not respect the user preference. This method allows you to determine when the event has been inverted and compensate by multiplying -1 if needed.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

isEnteringProximity

Returns YES to indicate that a pointing device is entering the proximity of its tablet and NO when it is leaving it.

- (BOOL)isEnteringProximity
Discussion

This method is valid for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

keyCode

Returns the virtual key code for the keyboard key associated with the receiving key event.

- (unsigned short)keyCode
Return Value

The virtual key code. The returned value is hardware-independent. The value returned is the same as the value returned in the kEventParamKeyCode when using Carbon Events.

Discussion

Raises an NSInternalInconsistencyException if sent to a non-key event.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

locationInWindow

Returns the receiver’s location in the base coordinate system of the associated window.

- (NSPoint)locationInWindow
Discussion

For non-mouse events the return value of this method is undefined.

With NSMouseMoved and possibly other events, the receiver can have a nil window (that is, window returns nil). In this case, locationInWindow returns the event location in screen coordinates.

In a method of a custom view that handles mouse events, you commonly use the locationInWindow method in conjunction with the NSView method convertPoint:fromView:to get the mouse location in the view’s coordinate system. For example:

NSPoint event_location = [theEvent locationInWindow];
NSPoint local_point = [self convertPoint:event_location fromView:nil];
Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSEvent.h

magnification

Returns the change in magnification.

- (CGFloat)magnification
Return Value

The change in magnification that should be added to the current scaling of an item to achieve the new scale factor.

Discussion

This message is valid for events of type NSEventTypeMagnify.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

modifierFlags

Returns an integer bit field indicating the modifier keys in effect for the receiver.

- (NSUInteger)modifierFlags
Discussion

You can examine individual flag settings using the C bitwise AND operator with the predefined key masks described in “Constants.” The lower 16 bits of the modifier flags are reserved for device-dependent bits.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

momentumPhase

The momentum phase of a scroll or flick gesture.

- (NSEventPhase)momentumPhase
Return Value

The current event phase. See “NSEventPhase” for possible values.

Discussion

This message is valid for NSScrollWheel events. With the Magic Mouse and some trackpads, the user can use a scroll wheel or flick gesture resulting in a stream of scroll events that dissipate over time.

The location of these scroll wheel events changes as the user moves the cursor. These events are attached to the view that is under the cursor when the flick occurs. A custom view can use this method to recognize these momentum scroll events and further route the event to the appropriate sub component.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

phase

Returns the phase of a gesture event such as swipe or scroll.

- (NSEventPhase)phase
Return Value

The current gesture even phase. See “NSEventPhase” for possible values.

Discussion

A gesture phrase are all the events that begin with a NSEventPhaseBegan and end with either a NSEventPhaseEnded or NSEventPhaseCancelled. All the gesture events are sent to the view under the cursor when the NSEventPhaseBegan occurred.

A swipe event with a phase of NSEventPhaseEnded indicates a successful swipe. A swipe event with a phase of NSEventPhaseCancelled indicates an unsuccessful swipe and any partial swipe animation should be undone.

A gesture scroll event starts with a NSEventPhaseBegan phase and ends with a NSPhaseEnded.

Legacy scroll wheel events (say from a Mighty Mouse) and momentum scroll wheel events have a phase of NSEventPhaseNone.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

pointingDeviceID

Returns the index of the pointing device currently in proximity with the tablet.

- (NSUInteger)pointingDeviceID
Discussion

This index is significant for multimode (or Dual Tracking) tablets that support multiple concurrent pointing devices; the index is incremented for each pointing device that comes into proximity. Otherwise, zero is always returned. The receiver of this message should be a mouse event object with subtype NSTabletProximityEventSubtype or an event of type NSTabletProximity.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

pointingDeviceSerialNumber

Returns the vendor-assigned serial number of a pointing device of a certain type.

- (NSUInteger)pointingDeviceSerialNumber
Discussion

Devices of different types, such as a puck and a pen, may have the same serial number. The receiver of this message should be a mouse event object with subtype NSTabletProximityEventSubtype or an event of type NSTabletProximity.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

pointingDeviceType

Returns a NSPointingDeviceType constant indicating the kind of pointing device associated with the receiver.

- (NSPointingDeviceType)pointingDeviceType
Discussion

For example, the device could be a pen, eraser, or cursor pointing device. This method is valid for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events. See “Constants” for descriptions of valid NSPointingDeviceType constants.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

pressure

Returns a value from 0.0 through 1.0 indicating the pressure applied to the input device (used for appropriate devices).

- (float)pressure
Discussion

For devices that aren’t pressure-sensitive, the value is either 0.0 or 1.0. Raises an NSInternalInconsistencyException if sent to a non-mouse event.

For tablet pointing devices that are in proximity, the pressure value is 0.0 if they are not actually touching the tablet. As the device is pressed into the tablet, the value is increased.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

rotation

Returns the rotation in degrees of the tablet pointing device associated with the receiver.

- (float)rotation
Discussion

Many devices do not support rotation, in which case the returned value is 0.0. This method is valid only for mouse events with subtype NSTabletPointEventSubtype and for NSTabletPoint events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

scrollingDeltaX

Returns the scroll wheel horizontal delta.

- (CGFloat)scrollingDeltaX
Return Value

The horizontal scroll wheel delta in points.

Discussion

This is the preferred method for accessing NSScrollWheel delta values. When hasPreciseScrollingDeltas returns NO, your application may which to modify this value.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

scrollingDeltaY

Returns the scroll wheel vertical delta.

- (CGFloat)scrollingDeltaY
Return Value

The vertical scroll wheel delta in points.

Discussion

This is the preferred method for accessing NSScrollWheel delta values. When hasPreciseScrollingDeltas returns NO, multiply the value returned by this method by the line or row height. Otherwise scroll by the returned amount.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

subtype

Returns the subtype of the receiving event object.

- (short)subtype
Discussion

Raises an NSInternalInconsistencyException if sent to an event not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, or NSPeriodic.

NSPeriodic events don’t use this attribute.

This method is also valid for mouse events on OS X v10.4 and later. See “Constants” for the predefined mouse and tablet subtypes.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

systemTabletID

Returns the index of the tablet device connected to the system.

- (NSUInteger)systemTabletID
Discussion

If multiple tablets are connected to the system, the system-tablet ID is incremented for each subsequent one. If there is only one tablet device, its system-tablet ID is zero. The receiver of this message should be a mouse event object with subtype NSTabletProximityEventSubtype or an event of type NSTabletProximity.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

tabletID

Returns the USB model identifier of the tablet device associated with the receiver.

- (NSUInteger)tabletID
Discussion

This method is valid for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

tangentialPressure

Reports the tangential pressure on the device that generated the event represented by the receiver.

- (float)tangentialPressure
Discussion

The value returned can range from -1.0 to 1.0. Tangential pressure is also known as barrel pressure. Only some pointing devices support tangential pressure. This method is valid for mouse events with subtype NSTabletPointEventSubtype and for NSTabletPoint events.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSEvent.h

tilt

Reports the scaled tilt values of the pointing device that generated the event represented by the receiver.

- (NSPoint)tilt
Discussion

The value returned can range from -1.0 to 1.0 for both axes. An x-coordinate value that is negative indicates a tilt to the left and a positive value indicates a tilt to the right; a y-coordinate value that is negative indicates a tilt to the top and a positive value indicates a tilt to the bottom. If the device is perfectly perpendicular to the table surface, the values are 0.0 for both axes. This method is valid for mouse events with subtype NSTabletPointEventSubtype and for NSTabletPoint events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

timestamp

Returns the time the receiver occurred in seconds since system startup.

- (NSTimeInterval)timestamp
Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

touchesMatchingPhase:inView:

Returns all the NSTouch objects associated with a specific phase.

- (NSSet *)touchesMatchingPhase:(NSTouchPhase)phase inView:(NSView *)view
Parameters
phase

The touch phase for which you want touches. See “NSTouchPhase” for the possible values.

view

The view for which touches are wanted. Touches that target this view, or any of the view’s descendants will be returned. Passing nil as the view gets all touches regardless of their targeted view.

Return Value

A set of applicable NSTouch objects.

Discussion

This method is only valid for gesture events (gesture, magnify, swipe, rotate, etc.). Using this method a view can get all of the touches associated with a gesture without overriding the individual touch responder methods.

Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
NSEvent.h

trackingArea

Returns the NSTrackingArea object that generated the event represented by the receiver.

- (NSTrackingArea *)trackingArea
Return Value

Returns the NSTrackingArea object that generated the event represented by the receiver. If the receiver is not a mouse-tracking event (that is, an event of type NSMouseEntered, NSMouseExited, or NSCursorUpdate), this method raises an NSInternalInconsistencyException. This method returns nil if the event was generated by a tracking rectangle (pre-OS X version 10.5) instead of a NSTrackingArea object.

Discussion

If no NSTrackingArea object is associated with the event because the event corresponds to a tracking rectangle installed with the NSView method addTrackingRect:owner:userData:assumeInside:, this method returns nil. Note that the trackingNumber method returns either an NSTrackingArea object or the NSTrackingRectTag constant depending on how the event was generated.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSEvent.h

trackingNumber

Returns the identifier of a mouse-tracking event.

- (NSInteger)trackingNumber
Discussion

This method returns either an NSTrackingArea object or a NSTrackingRectTag constant depending on whether the event was generated from an NSTrackingArea object or a call to addTrackingRect:owner:userData:assumeInside:. Valid mouse-tracking methods are of types NSMouseEntered, NSMouseExited, and NSCursorUpdate. This method raises an NSInternalInconsistencyException if sent to any other type of event.

The NSTrackingArea class is new with OS X version 10.5

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:

Allows tracking and user interface feedback of scroll wheel events.

- (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options dampenAmountThresholdMin:(CGFloat)minDampenThreshold max:(CGFloat)maxDampenThreshold usingHandler:(void (^)(CGFloat gestureAmount, NSEventPhase phase, BOOL isComplete, BOOL *stop))trackingHandler
Parameters
options

The swipe tracking events. See NSEventSwipeTrackingOptions for possible values.

minDampenThreshold

The minimum dampen threshold. This value is considered to encompass the “current view content area” and is referred to as a page. This is the number of pages with a negative position relative to the current page. The value must be less than or equal to zero.

maxDampenThreshold

The maximum dampen threshold. This value is considered to encompass the “current view content area” and is referred to as a page. This is the number of pages with a positive position relative to the current page. The value must be greater than or equal to zero.

trackingHandler

The Block used as the tracking handler.

The Block takes four arguments:

gestureAmount

The amount of gesture that you should display in the user interface. This may be a fractional amount.

The direction of the gestureAmount matches the user's "scroll content" preference setting as set in isDirectionInvertedFromDevice, which is based on a user preference.

Upon completion, the gesture amount will animate to one of the following values: -1, 0, 1.

phase

The phase of the physical gesture as performed by the user. See “NSEventPhase” for possible values. When the phase is either NSEventPhaseEnded, or NSEventPhaseMayBegin, the user has physically ended the gesture successfully or un-successfully, respectively.

Your handler will continue to be called with updated progress values to complete the fluid swipe animation with a phase of NSEventPhaseNone.

isComplete

Signifies the swipe and animation are complete and you should release any temporary animation objects.

The trackingHandler is released and will not be called further.

stop

A reference to a Boolean value. The Block can set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block

Discussion

Scroll wheel swipes are tracked not only to the end of the physical gesture phase by the user, but also to the completion of any user interface animation that should be performed. Using this method allows your implementation to maintain a consistent fluid feel with other applications. Any gesture amount outside of the supplied minimum and maximum dampen amount is pre-dampened for you to provide an elastic feel.

The swipe gestureAmount that would fall outside of the range specified by the minDampenThreshold and maxDampenThreshold are automatically dampened. For example, the user’s physical swipe action results in a value of .50, however, there is no page in that direction to swipe to. The gestureAmount reported is adjusted by a damping factor resulting in something like .125. As a developer, you simply treat the gestureAmount like you normally do, and the result is an elastic feedback effect to let the user know that there is nothing to swipe to in that direction.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

type

Returns the type of the receiving event.

- (NSEventType)type
Return Value

Returns the event type. The possible values are described in “NSEventType.”

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

uniqueID

Returns the unique identifier of the pointing device that generated the event represented by the receiver.

- (unsigned long long)uniqueID
Discussion

Also known as tool ID, this is a unique number recorded in the chip inside every pointing device. The unique ID makes it possible to assign a specific pointing device to a specific tablet. You can also use it to “sign” documents or to restrict access to document layers to a specific pointing device. This method is valid for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

userData

Returns data associated with a mouse-tracking event,

- (void *)userData
Discussion

The returned data was assigned to the mouse-tracking event when it was set up using the NSView method addTrackingRect:owner:userData:assumeInside:. It is only valid to send this message if the receiver represents an NSMouseEntered or NSMouseExited event. Raises an NSInternalInconsistencyException if sent to any other type of event object.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

vendorDefined

Returns an array of three vendor-defined NSNumber objects associated with the pointing-type event represented by the receiver.

- (id)vendorDefined
Discussion

The NSNumber objects encapsulate short values that vendors may return for various reasons; see the vendor documentation for details.This method is valid for mouse events with subtype NSTabletPointEventSubtype and for NSTabletPoint events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

vendorID

Returns the vendor identifier of the tablet associated with the receiver.

- (NSUInteger)vendorID
Discussion

The tablet is typically a USB device. This method is valid only for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSEvent.h

vendorPointingDeviceType

Returns a coded bit field whose set bits indicate the type of pointing device (within a vendor selection) associated with the receiver.

- (NSUInteger)vendorPointingDeviceType
Discussion

See the vendor documentation for an interpretation of significant bits. This method is valid only for mouse events with subtype NSTabletProximityEventSubtype and for NSTabletProximity events.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSEvent.h

window

Returns the window object associated with the receiver.

- (NSWindow *)window
Discussion

A periodic event, however, has no window; in this case the return value is undefined.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSEvent.h

windowNumber

Returns the identifier for the window device associated with the receiver.

- (NSInteger)windowNumber
Discussion

A periodic event, however, has no window; in this case the return value is undefined.

Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSEvent.h

Constants

NSEventSwipeTrackingOptions

These constants specify they swipe tracking options.

enum {
   NSEventSwipeTrackingLockDirection = 0x1 << 0,
   NSEventSwipeTrackingClampGestureAmount = 0x1 << 1
};
typedef NSUInteger NSEventSwipeTrackingOptions;
Constants
NSEventSwipeTrackingLockDirection

Clamp gestureAmount to 0 if the user starts to swipe in the opposite direction than they started.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventSwipeTrackingClampGestureAmount

Don't allow gestureAmount to go beyond +/-1.0

Available in OS X v10.7 and later.

Declared in NSEvent.h.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

NSEventGestureAxis

These constants specify the gesture tracking axis.

enum {
   NSEventGestureAxisNone = 0,
   NSEventGestureAxisHorizontal,
   NSEventGestureAxisVertical };
typedef NSInteger NSEventGestureAxis;
Constants
NSEventGestureAxisNone

There is no specific gesture axis.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventGestureAxisHorizontal

The gesture axis is horizontal.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventGestureAxisVertical

The gesture axis is vertical.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSEvent.h

NSEventPhase

These constants represent the possible phases during an event phase.

enum {
   NSEventPhaseNone        = 0,
   NSEventPhaseBegan       = 0x1 << 0,
   NSEventPhaseStationary  = 0x1 << 1,
   NSEventPhaseChanged     = 0x1 << 2,
   NSEventPhaseEnded       = 0x1 << 3,
   NSEventPhaseCancelled   = 0x1 << 4,
   NSEventPhaseMayBegin    = 0x1 << 5
};
#endif
typedef NSUInteger NSEventPhase;
Constants
NSEventPhaseNone

The event is not associated with a phase.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseBegan

An event phase has begun.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseStationary

An event phase is in progresses but hasn't moved since the previous event.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseChanged

An event phase has changed.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseEnded

The event phase ended..

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseCancelled

The system cancelled the event phase.

Available in OS X v10.7 and later.

Declared in NSEvent.h.

NSEventPhaseMayBegin

The system even phase may begin.

Available in OS X v10.8 and later.

Declared in NSEvent.h.

NSTouchPhase

These constants represent the possible phases during a touch gesture.

enum {
   NSTouchPhaseBegan           = 1 << 0,
   NSTouchPhaseMoved           = 1 << 1,
   NSTouchPhaseStationary      = 1 << 2,
   NSTouchPhaseEnded           = 1 << 3,
   NSTouchPhaseCancelled       = 1 << 4,
   NSTouchPhaseTouching = NSTouchPhaseBegan | NSTouchPhaseMoved | NSTouchPhaseStationary,
   NSTouchPhaseAny             = NSUIntegerMax
};
typedef NSUInteger NSTouchPhase;
Constants
NSTouchPhaseBegan

A finger for a given event touched the screen.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseMoved

A finger for a given event moved on the screen.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseStationary

A finger is touching the surface but hasn't moved since the previous event.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseEnded

A finger for a given event was lifted from the screen.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseCancelled

The system cancelled tracking for the touch.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseTouching

An NSTouchPhaseBegan, or NSTouchPhaseMoved, or NSTouchPhaseStationary phase is in progress.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSTouchPhaseAny

Any touch phase.

Available in OS X v10.6 and later.

Declared in NSTouch.h.

NSEventType

These constants represent various kinds of events. They are returned by type and are used as the first argument to the methods enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:, keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:, mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:, and otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:.

enum {
   NSLeftMouseDown      = 1,
   NSLeftMouseUp        = 2,
   NSRightMouseDown     = 3,
   NSRightMouseUp       = 4,
   NSMouseMoved         = 5,
   NSLeftMouseDragged   = 6,
   NSRightMouseDragged  = 7,
   NSMouseEntered       = 8,
   NSMouseExited        = 9,
   NSKeyDown            = 10,
   NSKeyUp              = 11,
   NSFlagsChanged       = 12,
   NSAppKitDefined      = 13,
   NSSystemDefined      = 14,
   NSApplicationDefined = 15,
   NSPeriodic           = 16,
   NSCursorUpdate       = 17,
   NSScrollWheel        = 22,
   NSTabletPoint        = 23,
   NSTabletProximity    = 24,
   NSOtherMouseDown     = 25,
   NSOtherMouseUp       = 26,
   NSOtherMouseDragged  = 27
   NSEventTypeGesture   = 29,
   NSEventTypeMagnify   = 30,
   NSEventTypeSwipe     = 31,
   NSEventTypeRotate    = 18,
   NSEventTypeBeginGesture = 19,
   NSEventTypeEndGesture   = 20
   NSEventTypeSmartMagnify = 32,
   NSEventTypeQuickLook   = 33
};
typedef NSUInteger NSEventType;
Constants
NSLeftMouseDown

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSLeftMouseUp

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseDown

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseUp

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSOtherMouseDown

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSOtherMouseUp

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSMouseMoved

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSLeftMouseDragged

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseDragged

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSOtherMouseDragged

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSMouseEntered

See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSMouseExited

See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSCursorUpdate

See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSKeyDown

See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSKeyUp

See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSFlagsChanged

See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSAppKitDefined

See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSSystemDefined

See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSApplicationDefined

See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPeriodic

See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSScrollWheel

See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSTabletPoint

An event representing the current state of a tablet pointing device, including its location, pressure, and tilt.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSTabletProximity

An event representing the proximity of a pointing device to its tablet.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSEventTypeGesture

An event that represents some type of gesture such as NSEventTypeMagnify, NSEventTypeSwipe, NSEventTypeRotate, NSEventTypeBeginGesture, or NSEventTypeEndGesture.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeMagnify

An event representing a pinch open or pinch close gesture.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeSwipe

An event representing a swipe gesture.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeRotate

An event representing a rotation gesture.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeBeginGesture

An event that represents a gesture beginning.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeEndGesture

An event that represents a gesture ending.

Available in OS X v10.5 and later.

Declared in NSEvent.h.

NSEventTypeSmartMagnify

NSEvent type for the smart zoom gesture (2-finger double tap on trackpads) along with a corresponding NSResponder method. In response to this event, you should intelligently magnify the content.

Available in OS X v10.8 and later.

Declared in NSEvent.h.

NSEventTypeQuickLook

Supports the new event responder method that initiates a Quicklook.

Available in OS X v10.8 and later.

Declared in NSEvent.h.

NSEventMaskFromType

These constants are masks for the events defined in “NSEventType.” Pass them to the NSCell method sendActionOn: to specify when an NSCell should send its action message.

enum {
   NSLeftMouseDownMask      = 1 << NSLeftMouseDown,
   NSLeftMouseUpMask        = 1 << NSLeftMouseUp,
   NSRightMouseDownMask     = 1 << NSRightMouseDown,
   NSRightMouseUpMask       = 1 << NSRightMouseUp,
   NSMouseMovedMask         = 1 << NSMouseMoved,
   NSLeftMouseDraggedMask   = 1 << NSLeftMouseDragged,
   NSRightMouseDraggedMask  = 1 << NSRightMouseDragged,
   NSMouseEnteredMask       = 1 << NSMouseEntered,
   NSMouseExitedMask        = 1 << NSMouseExited,
   NSKeyDownMask            = 1 << NSKeyDown,
   NSKeyUpMask              = 1 << NSKeyUp,
   NSFlagsChangedMask       = 1 << NSFlagsChanged,
   NSAppKitDefinedMask      = 1 << NSAppKitDefined,
   NSSystemDefinedMask      = 1 << NSSystemDefined,
   NSApplicationDefinedMask = 1 << NSApplicationDefined,
   NSPeriodicMask           = 1 << NSPeriodic,
   NSCursorUpdateMask       = 1 << NSCursorUpdate,
   NSScrollWheelMask        = 1 << NSScrollWheel,
   NSTabletPointMask           = 1 << NSTabletPoint,
   NSTabletProximityMask       = 1 << NSTabletProximity,
   NSOtherMouseDownMask     = 1 << NSOtherMouseDown,
   NSOtherMouseUpMask       = 1 << NSOtherMouseUp,
   NSOtherMouseDraggedMask  = 1 << NSOtherMouseDragged,
   NSEventMaskGesture          = 1 << NSEventTypeGesture,
   NSEventMaskMagnify          = 1 << NSEventTypeMagnify,
   NSEventMaskSwipe            = 1U << NSEventTypeSwipe,
   NSEventMaskRotate           = 1 << NSEventTypeRotate,
   NSEventMaskBeginGesture     = 1 << NSEventTypeBeginGesture,
   NSEventMaskEndGesture       = 1 << NSEventTypeEndGesture,
   NSEventMaskSmartMagnify = 1ULL << NSEventTypeSmartMagnify,
   NSAnyEventMask           = 0xffffffffU
};
typedef unsigned long long NSEventMask;
NSUInteger NSEventMaskFromType(NSEventType type) { return (1 << type); };
Constants
NSLeftMouseDownMask

Corresponds to NSLeftMouseDown. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSLeftMouseUpMask

Corresponds to NSLeftMouseUp. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseDownMask

Corresponds to NSRightMouseDown. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseUpMask

Corresponds to NSRightMouseUp. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSOtherMouseDownMask

Corresponds to NSOtherMouseDown. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSOtherMouseUpMask

Corresponds to NSOtherMouseUp. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSMouseMovedMask

Corresponds to NSMouseMoved. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSLeftMouseDraggedMask

Corresponds to NSLeftMouseDragged. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightMouseDraggedMask

Corresponds to NSRightMouseDragged. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSOtherMouseDraggedMask

Corresponds to NSOtherMouseDragged. See “Handling Mouse Events” in Cocoa Event Handling Guide.

Available in OS X v10.1 and later.

Declared in NSEvent.h.

NSMouseEnteredMask

Corresponds to NSMouseEntered. See See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide..

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSMouseExitedMask

Corresponds to NSMouseExited. See See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide..

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSCursorUpdateMask

Corresponds to NSCursorUpdate. See See “Mouse-Tracking and Cursor-Update Events” in Cocoa Event Handling Guide..

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSKeyDownMask

Corresponds to NSKeyDown. See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSKeyUpMask

Corresponds to NSKeyUp. See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSFlagsChangedMask

Corresponds to NSFlagsChanged. See “Handling Key Events” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSAppKitDefinedMask

Corresponds to NSAppKitDefined. See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSSystemDefinedMask

Corresponds to NSSystemDefined. See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSApplicationDefinedMask

Corresponds to NSApplicationDefined. See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPeriodicMask

Corresponds to NSPeriodic. See “Event Objects and Types” in Cocoa Event Handling Guide.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSScrollWheelMask

Corresponds to NSScrollWheel. See “Handling Mouse Events” in Cocoa Event Handling Guide..

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSTabletPointMask

Corresponds to NSTabletPoint.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSTabletProximityMask

Corresponds to NSTabletProximity.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSEventMaskGesture

Corresponds to NSEventTypeGesture.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskMagnify

Corresponds to NSEventTypeMagnify.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskSwipe

Corresponds to NSEventTypeSwipe.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskRotate

Corresponds to NSEventTypeRotate.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskBeginGesture

Corresponds to NSEventTypeBeginGesture.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskEndGesture

Corresponds to NSEventTypeEndGesture.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

NSEventMaskSmartMagnify

NSEvent type for the smart zoom gesture (2-finger double tap on trackpads) along with a corresponding NSResponder method. In response to this event, you should intelligently magnify the content.

Available in OS X v10.8 and later.

Declared in NSEvent.h.

Modifier Flags

The following constants (except for NSDeviceIndependentModifierFlagsMask) represent device-independent bits found in event modifier flags:

enum {
   NSAlphaShiftKeyMask = 1 << 16,
   NSShiftKeyMask      = 1 << 17,
   NSControlKeyMask    = 1 << 18,
   NSAlternateKeyMask  = 1 << 19,
   NSCommandKeyMask    = 1 << 20,
   NSNumericPadKeyMask = 1 << 21,
   NSHelpKeyMask       = 1 << 22,
   NSFunctionKeyMask   = 1 << 23,
   NSDeviceIndependentModifierFlagsMask = 0xffff0000U
};
Constants
NSAlphaShiftKeyMask

Set if Caps Lock key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSShiftKeyMask

Set if Shift key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSControlKeyMask

Set if Control key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSAlternateKeyMask

Set if Option or Alternate key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSCommandKeyMask

Set if Command key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSNumericPadKeyMask

Set if any key in the numeric keypad is pressed. The numeric keypad is generally on the right side of the keyboard. This is also set if any of the arrow keys are pressed (NSUpArrowFunctionKey, NSDownArrowFunctionKey, NSLeftArrowFunctionKey, and NSRightArrowFunctionKey).

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSHelpKeyMask

Set if the Help key is pressed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSFunctionKeyMask

Set if any function key is pressed. The function keys include the F keys at the top of most keyboards (F1, F2, and so on) and the navigation keys in the center of most keyboards (Help, Forward Delete, Home, End, Page Up, Page Down, and the arrow keys).

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSDeviceIndependentModifierFlagsMask

Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSPointingDeviceType

The following constants represent pointing-device types for NSTabletProximity events or mouse events with subtype NSTabletProximityEventSubtype. The pointingDeviceType method returns one of these constants.

typedef enum {
   NSUnknownPointingDevice = NX_TABLET_POINTER_UNKNOWN,
   NSPenPointingDevice     = NX_TABLET_POINTER_PEN,
   NSCursorPointingDevice  = NX_TABLET_POINTER_CURSOR,
   NSEraserPointingDevice  = NX_TABLET_POINTER_ERASER
} NSPointingDeviceType;
Constants
NSUnknownPointingDevice

Represents an unknown type of pointing device.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSPenPointingDevice

Represents the tip end of a stylus-like pointing device.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSCursorPointingDevice

Represents a cursor (or puck-like) pointing device.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSEraserPointingDevice

Represents the eraser end of a stylus-like pointing device.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

Mouse-event subtypes

The following constants represent mouse-event subtypes for mouse and tablet events (accessed with the subtype method).

enum {
   NSMouseEventSubtype           = NX_SUBTYPE_DEFAULT,
   NSTabletPointEventSubtype     = NX_SUBTYPE_TABLET_POINT,
   NSTabletProximityEventSubtype = NX_SUBTYPE_TABLET_PROXIMITY
   NSTouchEventSubtype             = NX_SUBTYPE_MOUSE_TOUCH
};
Constants
NSMouseEventSubtype

Indicates a purely mouse event.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSTabletPointEventSubtype

Indicates a tablet-pointer event; see description of NSTabletPoint.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSTabletProximityEventSubtype

Indicates a tablet-proximity event; see description of NSTabletProximity.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSTouchEventSubtype

Indicates a touch event subtype.

Available in OS X v10.6 and later.

Declared in NSEvent.h.

Tablet event masks

The following constants represent button masks for NSTabletPoint events or mouse events with subtype NSTabletPointEventSubtype. The buttonMask method returns a bit mask, which you test with one or more of these constants to determine the state of the buttons on a tablet pointing device.

enum {
   NSPenTipMask =       NX_TABLET_BUTTON_PENTIPMASK,
   NSPenLowerSideMask = NX_TABLET_BUTTON_PENLOWERSIDEMASK,
   NSPenUpperSideMask = NX_TABLET_BUTTON_PENUPPERSIDEMASK
};
Constants
NSPenTipMask

The pen tip is activated.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSPenLowerSideMask

The button on the lower side of the device is activated.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

NSPenUpperSideMask

The button on the upper side of the device is activated.

Available in OS X v10.4 and later.

Declared in NSEvent.h.

Types Defined by the Application Kit

These constants represent the types of events defined by the Application Kit.

enum {
   NSWindowExposedEventType = 0,
   NSApplicationActivatedEventType = 1,
   NSApplicationDeactivatedEventType = 2,
   NSWindowMovedEventType = 4,
   NSScreenChangedEventType = 8,
   NSAWTEventType = 16
};
Constants
NSWindowExposedEventType

A non-retained NSWindow has been exposed.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSApplicationActivatedEventType

The application has been activated.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSApplicationDeactivatedEventType

The application has been deactivated.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSWindowMovedEventType

An NSWindow has moved.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSScreenChangedEventType

An NSWindow has changed screens.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSAWTEventType

An event type used to support Java applications.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

Power-off event

This constant denotes that the user is turning off the computer.

enum {
   NSPowerOffEventType = 1
};
Constants
NSPowerOffEventType

Specifies that the user is turning off the computer.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

Function-Key Unicodes

These constants represent Unicode characters (0xF700–0xF8FF) that are reserved for function keys on the keyboard. Combined in NSStrings, they are the return values of the NSEvent methods characters and charactersIgnoringModifiers and may be used in some parameters in the NSEvent method keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:.

enum {
   NSUpArrowFunctionKey = 0xF700,
   NSDownArrowFunctionKey = 0xF701,
   NSLeftArrowFunctionKey = 0xF702,
   NSRightArrowFunctionKey = 0xF703,
   NSF1FunctionKey = 0xF704,
   NSF2FunctionKey = 0xF705,
   NSF3FunctionKey = 0xF706,
   NSF4FunctionKey = 0xF707,
   NSF5FunctionKey = 0xF708,
   NSF6FunctionKey = 0xF709,
   NSF7FunctionKey = 0xF70A,
   NSF8FunctionKey = 0xF70B,
   NSF9FunctionKey = 0xF70C,
   NSF10FunctionKey = 0xF70D,
   NSF11FunctionKey = 0xF70E,
   NSF12FunctionKey = 0xF70F,
   NSF13FunctionKey = 0xF710,
   NSF14FunctionKey = 0xF711,
   NSF15FunctionKey = 0xF712,
   NSF16FunctionKey = 0xF713,
   NSF17FunctionKey = 0xF714,
   NSF18FunctionKey = 0xF715,
   NSF19FunctionKey = 0xF716,
   NSF20FunctionKey = 0xF717,
   NSF21FunctionKey = 0xF718,
   NSF22FunctionKey = 0xF719,
   NSF23FunctionKey = 0xF71A,
   NSF24FunctionKey = 0xF71B,
   NSF25FunctionKey = 0xF71C,
   NSF26FunctionKey = 0xF71D,
   NSF27FunctionKey = 0xF71E,
   NSF28FunctionKey = 0xF71F,
   NSF29FunctionKey = 0xF720,
   NSF30FunctionKey = 0xF721,
   NSF31FunctionKey = 0xF722,
   NSF32FunctionKey = 0xF723,
   NSF33FunctionKey = 0xF724,
   NSF34FunctionKey = 0xF725,
   NSF35FunctionKey = 0xF726,
   NSInsertFunctionKey = 0xF727,
   NSDeleteFunctionKey = 0xF728,
   NSHomeFunctionKey = 0xF729,
   NSBeginFunctionKey = 0xF72A,
   NSEndFunctionKey = 0xF72B,
   NSPageUpFunctionKey = 0xF72C,
   NSPageDownFunctionKey = 0xF72D,
   NSPrintScreenFunctionKey = 0xF72E,
   NSScrollLockFunctionKey = 0xF72F,
   NSPauseFunctionKey = 0xF730,
   NSSysReqFunctionKey = 0xF731,
   NSBreakFunctionKey = 0xF732,
   NSResetFunctionKey = 0xF733,
   NSStopFunctionKey = 0xF734,
   NSMenuFunctionKey = 0xF735,
   NSUserFunctionKey = 0xF736,
   NSSystemFunctionKey = 0xF737,
   NSPrintFunctionKey = 0xF738,
   NSClearLineFunctionKey = 0xF739,
   NSClearDisplayFunctionKey = 0xF73A,
   NSInsertLineFunctionKey = 0xF73B,
   NSDeleteLineFunctionKey = 0xF73C,
   NSInsertCharFunctionKey = 0xF73D,
   NSDeleteCharFunctionKey = 0xF73E,
   NSPrevFunctionKey = 0xF73F,
   NSNextFunctionKey = 0xF740,
   NSSelectFunctionKey = 0xF741,
   NSExecuteFunctionKey = 0xF742,
   NSUndoFunctionKey = 0xF743,
   NSRedoFunctionKey = 0xF744,
   NSFindFunctionKey = 0xF745,
   NSHelpFunctionKey = 0xF746,
   NSModeSwitchFunctionKey = 0xF747
};
Constants
NSUpArrowFunctionKey

Up Arrow key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSDownArrowFunctionKey

Down Arrow key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSLeftArrowFunctionKey

Left Arrow key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRightArrowFunctionKey

Right Arrow key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF1FunctionKey

F1 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF2FunctionKey

F2 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF3FunctionKey

F3 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF4FunctionKey

F4 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF5FunctionKey

F5 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF6FunctionKey

F6 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF7FunctionKey

F7 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF8FunctionKey

F8 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF9FunctionKey

F9 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF10FunctionKey

F10 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF11FunctionKey

F11 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF12FunctionKey

F12 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF13FunctionKey

F13 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF14FunctionKey

F14 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF15FunctionKey

F15 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF16FunctionKey

F16 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF17FunctionKey

F17 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF18FunctionKey

F18 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF19FunctionKey

F19 key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF20FunctionKey

F20 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF21FunctionKey

F21 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF22FunctionKey

F22 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF23FunctionKey

F23 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF24FunctionKey

F24 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF25FunctionKey

F25 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF26FunctionKey

F26 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF27FunctionKey

F27 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF28FunctionKey

F28 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF29FunctionKey

F29 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF30FunctionKey

F30 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF31FunctionKey

F31 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF32FunctionKey

F32 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF33FunctionKey

F33 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF34FunctionKey

F34 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSF35FunctionKey

F35 key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSInsertFunctionKey

Insert key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSDeleteFunctionKey

Forward Delete key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSHomeFunctionKey

Home key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSBeginFunctionKey

Begin key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSEndFunctionKey

End key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPageUpFunctionKey

Page Up key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPageDownFunctionKey

Page Down key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPrintScreenFunctionKey

Print Screen key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSScrollLockFunctionKey

Scroll Lock key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPauseFunctionKey

Pause key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSSysReqFunctionKey

System Request key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSBreakFunctionKey

Break key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSResetFunctionKey

Reset key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSStopFunctionKey

Stop key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSMenuFunctionKey

Menu key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSUserFunctionKey

User key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSSystemFunctionKey

System key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPrintFunctionKey

Print key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSClearLineFunctionKey

Clear/Num Lock key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSClearDisplayFunctionKey

Clear Display key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSInsertLineFunctionKey

Insert Line key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSDeleteLineFunctionKey

Delete Line key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSInsertCharFunctionKey

Insert Character key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSDeleteCharFunctionKey

Delete Character key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSPrevFunctionKey

Previous key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSNextFunctionKey

Next key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSSelectFunctionKey

Select key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSExecuteFunctionKey

Execute key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSUndoFunctionKey

Undo key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSRedoFunctionKey

Redo key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSFindFunctionKey

Find key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSHelpFunctionKey

Help key.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

NSModeSwitchFunctionKey

Mode Switch key. Not on most Macintosh keyboards.

Available in OS X v10.0 and later.

Declared in NSEvent.h.

Discussion

Note that some function keys are handled at a lower level and are never seen by your application. They include the Volume Up key, Volume Down key, Volume Mute key, Eject key, and Function key found on many iBook and PowerBook computers.