Mac Developer Library

Developer

AppKit Framework Reference NSEvent Class Reference

Options
Deployment Target:

On This Page
Language:

NSEvent

An NSEvent object, or simply an event, contains information about an input action such as a mouse click or a key down. AppKit 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. More...

Inheritance


Conforms To


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.0 and later.
  • Returns a new NSEvent object describing a key event.

    Declaration

    Swift

    class func keyEventWithType(_ type: NSEventType, location location: NSPoint, modifierFlags flags: NSEventModifierFlags, timestamp time: NSTimeInterval, windowNumber windowNum: Int, context context: NSGraphicsContext?, characters characters: String, charactersIgnoringModifiers unmodCharacters: String, isARepeat repeatKey: Bool, keyCode code: UInt16) -> NSEvent?

    Objective-C

    + (NSEvent *)keyEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)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

    YEStrue if the key event is a repeat caused by the user holding the key down, NOfalse 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    class func mouseEventWithType(_ type: NSEventType, location location: NSPoint, modifierFlags flags: NSEventModifierFlags, timestamp time: NSTimeInterval, windowNumber windowNum: Int, context context: NSGraphicsContext?, eventNumber eventNumber: Int, clickCount clickNumber: Int, pressure pressure: Float) -> NSEvent?

    Objective-C

    + (NSEvent *)mouseEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    class func enterExitEventWithType(_ type: NSEventType, location location: NSPoint, modifierFlags flags: NSEventModifierFlags, timestamp time: NSTimeInterval, windowNumber windowNum: Int, context context: NSGraphicsContext?, eventNumber eventNumber: Int, trackingNumber trackingNumber: Int, userData userData: UnsafeMutablePointer<Void>) -> NSEvent?

    Objective-C

    + (NSEvent *)enterExitEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)windowNum 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a new NSEvent object describing a custom event.

    Declaration

    Swift

    class func otherEventWithType(_ type: NSEventType, location location: NSPoint, modifierFlags flags: NSEventModifierFlags, timestamp time: NSTimeInterval, windowNumber windowNum: Int, context context: NSGraphicsContext?, subtype subtype: Int16, data1 data1: Int, data2 data2: Int) -> NSEvent?

    Objective-C

    + (NSEvent *)otherEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)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:

    • NSAppKitDefined

    • NSSystemDefined

    • NSApplicationDefined

    • NSPeriodic

    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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    init?(eventRef eventRef: UnsafePointer<Void>) -> NSEvent

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

    See Also

    – eventRef

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

    Declaration

    Swift

    init?(CGEvent cgEvent: CGEvent) -> NSEvent

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

    See Also

    – CGEvent

  • Returns the display graphics context of the receiver.

    Declaration

    Swift

    var context: NSGraphicsContext? { get }

    Objective-C

    @property(readonly, strong) NSGraphicsContext *context

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var locationInWindow: NSPoint { get }

    Objective-C

    @property(readonly) 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];

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – window

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

    Declaration

    Swift

    var modifierFlags: NSEventModifierFlags { get }

    Objective-C

    @property(readonly) NSEventModifierFlags 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var timestamp: NSTimeInterval { get }

    Objective-C

    @property(readonly) NSTimeInterval timestamp

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the type of the receiving event.

    Declaration

    Swift

    var type: NSEventType { get }

    Objective-C

    @property(readonly) NSEventType type

    Return Value

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the window object associated with the receiver.

    Declaration

    Swift

    unowned(unsafe) var window: NSWindow? { get }

    Objective-C

    @property(readonly, assign) NSWindow *window

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var windowNumber: Int { get }

    Objective-C

    @property(readonly) NSInteger windowNumber

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – window

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

    Declaration

    Swift

    var eventRef: UnsafePointer<Void> { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns a Core Graphics event object corresponding to the receiver.

    Declaration

    Swift

    var CGEvent: CGEvent? { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns the currently pressed modifier flags.

    Declaration

    Swift

    class func modifierFlags() -> NSEventModifierFlags

    Objective-C

    + (NSEventModifierFlags)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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

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

    Declaration

    Swift

    class func keyRepeatDelay() -> NSTimeInterval

    Objective-C

    + (NSTimeInterval)keyRepeatDelay

    Return Value

    The delay interval, in seconds.

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns the length between subsequent key repeat events being posted.

    Declaration

    Swift

    class func keyRepeatInterval() -> NSTimeInterval

    Objective-C

    + (NSTimeInterval)keyRepeatInterval

    Return Value

    The repeat interval, in seconds.

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

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

    Declaration

    Swift

    var characters: String? { get }

    Objective-C

    @property(readonly, copy) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var charactersIgnoringModifiers: String? { get }

    Objective-C

    @property(readonly, copy) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isARepeat isARepeat Available in OS X v10.0 through OS X v10.9

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

    Declaration

    Objective-C

    - (BOOL)isARepeat

    Discussion

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

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

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

    Declaration

    Swift

    var keyCode: UInt16 { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the indices of the currently depressed mouse buttons.

    Declaration

    Swift

    class func pressedMouseButtons() -> Int

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

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

    Declaration

    Swift

    class func doubleClickInterval() -> NSTimeInterval

    Objective-C

    + (NSTimeInterval)doubleClickInterval

    Return Value

    The double-click time interval, in seconds.

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Reports the current mouse position in screen coordinates.

    Declaration

    Swift

    class func mouseLocation() -> NSPoint

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var buttonNumber: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.1 and later.

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

    Declaration

    Swift

    var clickCount: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var pressure: Float { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Controls whether mouse-movement event coalescing is enabled.

    Declaration

    Swift

    class func setMouseCoalescingEnabled(_ flag: Bool)

    Objective-C

    + (void)setMouseCoalescingEnabled:(BOOL)flag

    Parameters

    flag

    YEStrue to enable mouse-movement event coalescing, NOfalse to disable it.

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Indicates whether mouse-movement event coalescing is enabled.

    Declaration

    Swift

    class func isMouseCoalescingEnabled() -> Bool

    Objective-C

    + (BOOL)isMouseCoalescingEnabled

    Return Value

    YEStrue if mouse-movement event coalescing is enabled, NOfalse if it is disabled.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns additional data associated with the receiver.

    Declaration

    Swift

    var data1: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns additional data associated with the receiver.

    Declaration

    Swift

    var data2: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the subtype of the receiving event object.

    Declaration

    Swift

    var subtype: NSEventSubtype { get }

    Objective-C

    @property(readonly) NSEventSubtype 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var deltaX: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat deltaX

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var deltaY: CGFloat { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var deltaZ: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat deltaZ

    Discussion

    This value is typically 0.0.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var capabilityMask: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var deviceID: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • isEnteringProximity isEnteringProximity Available in OS X v10.4 through OS X v10.9

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

    Declaration

    Objective-C

    - (BOOL)isEnteringProximity

    Discussion

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

    Import Statement

    Availability

    Available in OS X v10.4 through OS X v10.9.

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

    Declaration

    Swift

    var pointingDeviceID: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var pointingDeviceSerialNumber: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var pointingDeviceType: NSPointingDeviceType { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var systemTabletID: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var tabletID: Int { get }

    Objective-C

    @property(readonly) NSUInteger tabletID

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var uniqueID: UInt64 { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var vendorID: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var vendorPointingDeviceType: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – vendorID

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

    Declaration

    Swift

    var absoluteX: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var absoluteY: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var absoluteZ: Int { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var buttonMask: NSEventButtonMask { get }

    Objective-C

    @property(readonly) NSEventButtonMask 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var rotation: Float { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var tangentialPressure: Float { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – pressure

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

    Declaration

    Swift

    var tilt: NSPoint { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    var vendorDefined: AnyObject { get }

    Objective-C

    @property(readonly, strong) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Begins generating periodic events for the current thread.

    Declaration

    Swift

    class func startPeriodicEventsAfterDelay(_ delaySeconds: NSTimeInterval, withPeriod periodSeconds: NSTimeInterval)

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    class func stopPeriodicEvents()

    Objective-C

    + (void)stopPeriodicEvents

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the change in magnification.

    Declaration

    Swift

    var magnification: CGFloat { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns all the NSTouch objects associated with a specific phase.

    Declaration

    Swift

    func touchesMatchingPhase(_ phase: NSTouchPhase, inView view: NSView?) -> NSSet

    Objective-C

    - (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

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

    Declaration

    Swift

    class func isSwipeTrackingFromScrollEventsEnabled() -> Bool

    Objective-C

    + (BOOL)isSwipeTrackingFromScrollEventsEnabled

    Return Value

    YEStrue if swipe tracking for scroll events is enable; otherwise NOfalse.

    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:.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns whether there are precise scrolling deltas available.

    Declaration

    Swift

    var hasPreciseScrollingDeltas: Bool { get }

    Objective-C

    @property(readonly) BOOL hasPreciseScrollingDeltas

    Return Value

    YEStrue if precise scrolling deltas are available; NOfalse 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns the scroll wheel horizontal delta.

    Declaration

    Swift

    var scrollingDeltaX: CGFloat { get }

    Objective-C

    @property(readonly) 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 NOfalse, your application may which to modify this value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns the scroll wheel vertical delta.

    Declaration

    Swift

    var scrollingDeltaY: CGFloat { get }

    Objective-C

    @property(readonly) 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 NOfalse, multiply the value returned by this method by the line or row height. Otherwise scroll by the returned amount.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • The momentum phase of a scroll or flick gesture.

    Declaration

    Swift

    var momentumPhase: NSEventPhase { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

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

    Declaration

    Swift

    var phase: NSEventPhase { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Allows tracking and user interface feedback of scroll wheel events.

    Declaration

    Swift

    func trackSwipeEventWithOptions(_ options: NSEventSwipeTrackingOptions, dampenAmountThresholdMin minDampenThreshold: CGFloat, max maxDampenThreshold: CGFloat, usingHandler trackingHandler: (CGFloat, NSEventPhase, Bool, UnsafeMutablePointer<ObjCBool>) -> Void)

    Objective-C

    - (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 YEStrue to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YEStrue 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • isDirectionInvertedFromDevice isDirectionInvertedFromDevice Available in OS X v10.7 through OS X v10.9

    Returns whether the user has changed the device inversion.

    Declaration

    Objective-C

    - (BOOL)isDirectionInvertedFromDevice

    Return Value

    Returns YEStrue if the direction is inverted; NOfalse 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.

    Import Statement

    Availability

    Available in OS X v10.7 through OS X v10.9.

  • Returns the location of the receiver in the coordinate system of the given node.

    Declaration

    Swift

    func locationInNode(_ node: SKNode!) -> CGPoint

    Objective-C

    - (CGPoint)locationInNode:(SKNode *)node

    Parameters

    node

    A node that is a descendant of a scene presented in the window that received the mouse event.

    Return Value

    The location of the event in the node’s coordinate system.

    Import Statement

    import SpriteKit

    Availability

    Available in OS X v10.9 and later.

Data Types

  • These constants specify they swipe tracking options.

    Declaration

    Swift

    struct NSEventSwipeTrackingOptions : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var LockDirection: NSEventSwipeTrackingOptions { get } static var ClampGestureAmount: NSEventSwipeTrackingOptions { get } }

    Objective-C

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

    Constants

    • LockDirection

      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.

    • ClampGestureAmount

      NSEventSwipeTrackingClampGestureAmount

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

      Available in OS X v10.7 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • These constants specify the gesture tracking axis.

    Declaration

    Swift

    enum NSEventGestureAxis : Int { case None case Horizontal case Vertical }

    Objective-C

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

    Constants

    • None

      NSEventGestureAxisNone

      There is no specific gesture axis.

      Available in OS X v10.7 and later.

    • Horizontal

      NSEventGestureAxisHorizontal

      The gesture axis is horizontal.

      Available in OS X v10.7 and later.

    • Vertical

      NSEventGestureAxisVertical

      The gesture axis is vertical.

      Available in OS X v10.7 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • These constants represent the possible phases during an event phase.

    Declaration

    Swift

    struct NSEventPhase : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var None: NSEventPhase { get } static var Began: NSEventPhase { get } static var Stationary: NSEventPhase { get } static var Changed: NSEventPhase { get } static var Ended: NSEventPhase { get } static var Cancelled: NSEventPhase { get } static var MayBegin: NSEventPhase { get } }

    Objective-C

    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

    • None

      NSEventPhaseNone

      The event is not associated with a phase.

      Available in OS X v10.7 and later.

    • Began

      NSEventPhaseBegan

      An event phase has begun.

      Available in OS X v10.7 and later.

    • Stationary

      NSEventPhaseStationary

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

      Available in OS X v10.7 and later.

    • Changed

      NSEventPhaseChanged

      An event phase has changed.

      Available in OS X v10.7 and later.

    • Ended

      NSEventPhaseEnded

      The event phase ended..

      Available in OS X v10.7 and later.

    • Cancelled

      NSEventPhaseCancelled

      The system cancelled the event phase.

      Available in OS X v10.7 and later.

    • MayBegin

      NSEventPhaseMayBegin

      The system even phase may begin.

      Available in OS X v10.7 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • These constants represent the possible phases during a touch gesture.

    Declaration

    Swift

    struct NSTouchPhase : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var Began: NSTouchPhase { get } static var Moved: NSTouchPhase { get } static var Stationary: NSTouchPhase { get } static var Ended: NSTouchPhase { get } static var Cancelled: NSTouchPhase { get } static var Touching: NSTouchPhase { get } static var Any: NSTouchPhase { get } }

    Objective-C

    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

    • Began

      NSTouchPhaseBegan

      A finger for a given event touched the screen.

      Available in OS X v10.7 and later.

    • Moved

      NSTouchPhaseMoved

      A finger for a given event moved on the screen.

      Available in OS X v10.7 and later.

    • Stationary

      NSTouchPhaseStationary

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

      Available in OS X v10.7 and later.

    • Ended

      NSTouchPhaseEnded

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

      Available in OS X v10.7 and later.

    • Cancelled

      NSTouchPhaseCancelled

      The system cancelled tracking for the touch.

      Available in OS X v10.7 and later.

    • Touching

      NSTouchPhaseTouching

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

      Available in OS X v10.7 and later.

    • Any

      NSTouchPhaseAny

      Any touch phase.

      Available in OS X v10.7 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Declaration

    Swift

    enum NSEventType : UInt { case LeftMouseDown case LeftMouseUp case RightMouseDown case RightMouseUp case MouseMoved case LeftMouseDragged case RightMouseDragged case MouseEntered case MouseExited case KeyDown case KeyUp case FlagsChanged case AppKitDefined case SystemDefined case ApplicationDefined case Periodic case CursorUpdate case ScrollWheel case TabletPoint case TabletProximity case OtherMouseDown case OtherMouseUp case OtherMouseDragged case EventTypeGesture case EventTypeMagnify case EventTypeSwipe case EventTypeRotate case EventTypeBeginGesture case EventTypeEndGesture case EventTypeSmartMagnify case EventTypeQuickLook }

    Objective-C

    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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • 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.

    Declaration

    Swift

    struct NSEventMask : RawOptionSetType { init(_ rawValue: UInt64) init(rawValue rawValue: UInt64) static var LeftMouseDownMask: NSEventMask { get } static var LeftMouseUpMask: NSEventMask { get } static var RightMouseDownMask: NSEventMask { get } static var RightMouseUpMask: NSEventMask { get } static var MouseMovedMask: NSEventMask { get } static var LeftMouseDraggedMask: NSEventMask { get } static var RightMouseDraggedMask: NSEventMask { get } static var MouseEnteredMask: NSEventMask { get } static var MouseExitedMask: NSEventMask { get } static var KeyDownMask: NSEventMask { get } static var KeyUpMask: NSEventMask { get } static var FlagsChangedMask: NSEventMask { get } static var AppKitDefinedMask: NSEventMask { get } static var SystemDefinedMask: NSEventMask { get } static var ApplicationDefinedMask: NSEventMask { get } static var PeriodicMask: NSEventMask { get } static var CursorUpdateMask: NSEventMask { get } static var ScrollWheelMask: NSEventMask { get } static var TabletPointMask: NSEventMask { get } static var TabletProximityMask: NSEventMask { get } static var OtherMouseDownMask: NSEventMask { get } static var OtherMouseUpMask: NSEventMask { get } static var OtherMouseDraggedMask: NSEventMask { get } static var EventMaskGesture: NSEventMask { get } static var EventMaskMagnify: NSEventMask { get } static var EventMaskSwipe: NSEventMask { get } static var EventMaskRotate: NSEventMask { get } static var EventMaskBeginGesture: NSEventMask { get } static var EventMaskEndGesture: NSEventMask { get } static var EventMaskSmartMagnify: NSEventMask { get } static var AnyEventMask: NSEventMask { get } }

    Objective-C

    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

    Import Statement

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

    Declaration

    Swift

    struct NSEventModifierFlags : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var AlphaShiftKeyMask: NSEventModifierFlags { get } static var ShiftKeyMask: NSEventModifierFlags { get } static var ControlKeyMask: NSEventModifierFlags { get } static var AlternateKeyMask: NSEventModifierFlags { get } static var CommandKeyMask: NSEventModifierFlags { get } static var NumericPadKeyMask: NSEventModifierFlags { get } static var HelpKeyMask: NSEventModifierFlags { get } static var FunctionKeyMask: NSEventModifierFlags { get } static var DeviceIndependentModifierFlagsMask: NSEventModifierFlags { get } }

    Objective-C

    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

    • AlphaShiftKeyMask

      NSAlphaShiftKeyMask

      Set if Caps Lock key is pressed.

      Available in OS X v10.0 and later.

    • ShiftKeyMask

      NSShiftKeyMask

      Set if Shift key is pressed.

      Available in OS X v10.0 and later.

    • ControlKeyMask

      NSControlKeyMask

      Set if Control key is pressed.

      Available in OS X v10.0 and later.

    • AlternateKeyMask

      NSAlternateKeyMask

      Set if Option or Alternate key is pressed.

      Available in OS X v10.0 and later.

    • CommandKeyMask

      NSCommandKeyMask

      Set if Command key is pressed.

      Available in OS X v10.0 and later.

    • NumericPadKeyMask

      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.

    • HelpKeyMask

      NSHelpKeyMask

      Set if the Help key is pressed.

      Available in OS X v10.0 and later.

    • FunctionKeyMask

      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.

    • DeviceIndependentModifierFlagsMask

      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.

    Import Statement

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

    Declaration

    Swift

    enum NSPointingDeviceType : UInt { case UnknownPointingDevice case PenPointingDevice case CursorPointingDevice case EraserPointingDevice }

    Objective-C

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

    Constants

    • UnknownPointingDevice

      NSUnknownPointingDevice

      Represents an unknown type of pointing device.

      Available in OS X v10.4 and later.

    • PenPointingDevice

      NSPenPointingDevice

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

      Available in OS X v10.4 and later.

    • CursorPointingDevice

      NSCursorPointingDevice

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

      Available in OS X v10.4 and later.

    • EraserPointingDevice

      NSEraserPointingDevice

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

      Available in OS X v10.4 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

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

    Declaration

    Swift

    enum NSEventSubtype : Int16 { case NSWindowExposedEventType case NSApplicationActivatedEventType case NSApplicationDeactivatedEventType case NSWindowMovedEventType case NSScreenChangedEventType case NSAWTEventType case NSTouchEventSubtype }

    Objective-C

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

    Constants

    • NSMouseEventSubtype

      NSMouseEventSubtype

      Indicates a purely mouse event.

      Available in OS X v10.4 and later.

    • NSTabletPointEventSubtype

      NSTabletPointEventSubtype

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

      Available in OS X v10.4 and later.

    • NSTabletProximityEventSubtype

      NSTabletProximityEventSubtype

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

      Available in OS X v10.4 and later.

    • NSTouchEventSubtype

      NSTouchEventSubtype

      Indicates a touch event subtype.

      Available in OS X v10.6 and later.

    Import Statement

  • 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.

    Declaration

    Swift

    struct NSEventButtonMask : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var PenTipMask: NSEventButtonMask { get } static var PenLowerSideMask: NSEventButtonMask { get } static var PenUpperSideMask: NSEventButtonMask { get } }

    Objective-C

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

    Constants

    • PenTipMask

      NSPenTipMask

      The pen tip is activated.

      Available in OS X v10.4 and later.

    • PenLowerSideMask

      NSPenLowerSideMask

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

      Available in OS X v10.4 and later.

    • PenUpperSideMask

      NSPenUpperSideMask

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

      Available in OS X v10.4 and later.

    Import Statement

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

    Declaration

    Swift

    enum NSEventSubtype : Int16 { case NSWindowExposedEventType case NSApplicationActivatedEventType case NSApplicationDeactivatedEventType case NSWindowMovedEventType case NSScreenChangedEventType case NSAWTEventType case NSTouchEventSubtype }

    Objective-C

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

    Constants

    • NSWindowExposedEventType

      NSWindowExposedEventType

      A non-retained NSWindow has been exposed.

      Available in OS X v10.0 and later.

    • NSApplicationActivatedEventType

      NSApplicationActivatedEventType

      The application has been activated.

      Available in OS X v10.0 and later.

    • NSApplicationDeactivatedEventType

      NSApplicationDeactivatedEventType

      The application has been deactivated.

      Available in OS X v10.0 and later.

    • NSWindowMovedEventType

      NSWindowMovedEventType

      An NSWindow has moved.

      Available in OS X v10.0 and later.

    • NSScreenChangedEventType

      NSScreenChangedEventType

      An NSWindow has changed screens.

      Available in OS X v10.0 and later.

    • NSAWTEventType

      NSAWTEventType

      An event type used to support Java applications.

      Available in OS X v10.0 and later.

    Import Statement

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

    Declaration

    Objective-C

    enum { NSPowerOffEventType = 1 };

    Constants

    • NSPowerOffEventType

      NSPowerOffEventType

      Specifies that the user is turning off the computer.

      Available in OS X v10.0 and later.

    Import Statement

  • 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:.

    Declaration

    Swift

    var NSUpArrowFunctionKey: Int { get } var NSDownArrowFunctionKey: Int { get } var NSLeftArrowFunctionKey: Int { get } var NSRightArrowFunctionKey: Int { get } var NSF1FunctionKey: Int { get } var NSF2FunctionKey: Int { get } var NSF3FunctionKey: Int { get } var NSF4FunctionKey: Int { get } var NSF5FunctionKey: Int { get } var NSF6FunctionKey: Int { get } var NSF7FunctionKey: Int { get } var NSF8FunctionKey: Int { get } var NSF9FunctionKey: Int { get } var NSF10FunctionKey: Int { get } var NSF11FunctionKey: Int { get } var NSF12FunctionKey: Int { get } var NSF13FunctionKey: Int { get } var NSF14FunctionKey: Int { get } var NSF15FunctionKey: Int { get } var NSF16FunctionKey: Int { get } var NSF17FunctionKey: Int { get } var NSF18FunctionKey: Int { get } var NSF19FunctionKey: Int { get } var NSF20FunctionKey: Int { get } var NSF21FunctionKey: Int { get } var NSF22FunctionKey: Int { get } var NSF23FunctionKey: Int { get } var NSF24FunctionKey: Int { get } var NSF25FunctionKey: Int { get } var NSF26FunctionKey: Int { get } var NSF27FunctionKey: Int { get } var NSF28FunctionKey: Int { get } var NSF29FunctionKey: Int { get } var NSF30FunctionKey: Int { get } var NSF31FunctionKey: Int { get } var NSF32FunctionKey: Int { get } var NSF33FunctionKey: Int { get } var NSF34FunctionKey: Int { get } var NSF35FunctionKey: Int { get } var NSInsertFunctionKey: Int { get } var NSDeleteFunctionKey: Int { get } var NSHomeFunctionKey: Int { get } var NSBeginFunctionKey: Int { get } var NSEndFunctionKey: Int { get } var NSPageUpFunctionKey: Int { get } var NSPageDownFunctionKey: Int { get } var NSPrintScreenFunctionKey: Int { get } var NSScrollLockFunctionKey: Int { get } var NSPauseFunctionKey: Int { get } var NSSysReqFunctionKey: Int { get } var NSBreakFunctionKey: Int { get } var NSResetFunctionKey: Int { get } var NSStopFunctionKey: Int { get } var NSMenuFunctionKey: Int { get } var NSUserFunctionKey: Int { get } var NSSystemFunctionKey: Int { get } var NSPrintFunctionKey: Int { get } var NSClearLineFunctionKey: Int { get } var NSClearDisplayFunctionKey: Int { get } var NSInsertLineFunctionKey: Int { get } var NSDeleteLineFunctionKey: Int { get } var NSInsertCharFunctionKey: Int { get } var NSDeleteCharFunctionKey: Int { get } var NSPrevFunctionKey: Int { get } var NSNextFunctionKey: Int { get } var NSSelectFunctionKey: Int { get } var NSExecuteFunctionKey: Int { get } var NSUndoFunctionKey: Int { get } var NSRedoFunctionKey: Int { get } var NSFindFunctionKey: Int { get } var NSHelpFunctionKey: Int { get } var NSModeSwitchFunctionKey: Int { get }

    Objective-C

    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

      NSUpArrowFunctionKey

      Up Arrow key.

      Available in OS X v10.0 and later.

    • NSDownArrowFunctionKey

      NSDownArrowFunctionKey

      Down Arrow key.

      Available in OS X v10.0 and later.

    • NSLeftArrowFunctionKey

      NSLeftArrowFunctionKey

      Left Arrow key.

      Available in OS X v10.0 and later.

    • NSRightArrowFunctionKey

      NSRightArrowFunctionKey

      Right Arrow key.

      Available in OS X v10.0 and later.

    • NSF1FunctionKey

      NSF1FunctionKey

      F1 key.

      Available in OS X v10.0 and later.

    • NSF2FunctionKey

      NSF2FunctionKey

      F2 key.

      Available in OS X v10.0 and later.

    • NSF3FunctionKey

      NSF3FunctionKey

      F3 key.

      Available in OS X v10.0 and later.

    • NSF4FunctionKey

      NSF4FunctionKey

      F4 key.

      Available in OS X v10.0 and later.

    • NSF5FunctionKey

      NSF5FunctionKey

      F5 key.

      Available in OS X v10.0 and later.

    • NSF6FunctionKey

      NSF6FunctionKey

      F6 key.

      Available in OS X v10.0 and later.

    • NSF7FunctionKey

      NSF7FunctionKey

      F7 key.

      Available in OS X v10.0 and later.

    • NSF8FunctionKey

      NSF8FunctionKey

      F8 key.

      Available in OS X v10.0 and later.

    • NSF9FunctionKey

      NSF9FunctionKey

      F9 key.

      Available in OS X v10.0 and later.

    • NSF10FunctionKey

      NSF10FunctionKey

      F10 key.

      Available in OS X v10.0 and later.

    • NSF11FunctionKey

      NSF11FunctionKey

      F11 key.

      Available in OS X v10.0 and later.

    • NSF12FunctionKey

      NSF12FunctionKey

      F12 key.

      Available in OS X v10.0 and later.

    • NSF13FunctionKey

      NSF13FunctionKey

      F13 key.

      Available in OS X v10.0 and later.

    • NSF14FunctionKey

      NSF14FunctionKey

      F14 key.

      Available in OS X v10.0 and later.

    • NSF15FunctionKey

      NSF15FunctionKey

      F15 key.

      Available in OS X v10.0 and later.

    • NSF16FunctionKey

      NSF16FunctionKey

      F16 key.

      Available in OS X v10.0 and later.

    • NSF17FunctionKey

      NSF17FunctionKey

      F17 key.

      Available in OS X v10.0 and later.

    • NSF18FunctionKey

      NSF18FunctionKey

      F18 key.

      Available in OS X v10.0 and later.

    • NSF19FunctionKey

      NSF19FunctionKey

      F19 key.

      Available in OS X v10.0 and later.

    • NSF20FunctionKey

      NSF20FunctionKey

      F20 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF21FunctionKey

      NSF21FunctionKey

      F21 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF22FunctionKey

      NSF22FunctionKey

      F22 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF23FunctionKey

      NSF23FunctionKey

      F23 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF24FunctionKey

      NSF24FunctionKey

      F24 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF25FunctionKey

      NSF25FunctionKey

      F25 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF26FunctionKey

      NSF26FunctionKey

      F26 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF27FunctionKey

      NSF27FunctionKey

      F27 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF28FunctionKey

      NSF28FunctionKey

      F28 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF29FunctionKey

      NSF29FunctionKey

      F29 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF30FunctionKey

      NSF30FunctionKey

      F30 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF31FunctionKey

      NSF31FunctionKey

      F31 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF32FunctionKey

      NSF32FunctionKey

      F32 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF33FunctionKey

      NSF33FunctionKey

      F33 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF34FunctionKey

      NSF34FunctionKey

      F34 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSF35FunctionKey

      NSF35FunctionKey

      F35 key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSInsertFunctionKey

      NSInsertFunctionKey

      Insert key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSDeleteFunctionKey

      NSDeleteFunctionKey

      Forward Delete key.

      Available in OS X v10.0 and later.

    • NSHomeFunctionKey

      NSHomeFunctionKey

      Home key.

      Available in OS X v10.0 and later.

    • NSBeginFunctionKey

      NSBeginFunctionKey

      Begin key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSEndFunctionKey

      NSEndFunctionKey

      End key.

      Available in OS X v10.0 and later.

    • NSPageUpFunctionKey

      NSPageUpFunctionKey

      Page Up key.

      Available in OS X v10.0 and later.

    • NSPageDownFunctionKey

      NSPageDownFunctionKey

      Page Down key.

      Available in OS X v10.0 and later.

    • NSPrintScreenFunctionKey

      NSPrintScreenFunctionKey

      Print Screen key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSScrollLockFunctionKey

      NSScrollLockFunctionKey

      Scroll Lock key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSPauseFunctionKey

      NSPauseFunctionKey

      Pause key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSSysReqFunctionKey

      NSSysReqFunctionKey

      System Request key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSBreakFunctionKey

      NSBreakFunctionKey

      Break key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSResetFunctionKey

      NSResetFunctionKey

      Reset key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSStopFunctionKey

      NSStopFunctionKey

      Stop key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSMenuFunctionKey

      NSMenuFunctionKey

      Menu key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSUserFunctionKey

      NSUserFunctionKey

      User key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSSystemFunctionKey

      NSSystemFunctionKey

      System key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSPrintFunctionKey

      NSPrintFunctionKey

      Print key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSClearLineFunctionKey

      NSClearLineFunctionKey

      Clear/Num Lock key.

      Available in OS X v10.0 and later.

    • NSClearDisplayFunctionKey

      NSClearDisplayFunctionKey

      Clear Display key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSInsertLineFunctionKey

      NSInsertLineFunctionKey

      Insert Line key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSDeleteLineFunctionKey

      NSDeleteLineFunctionKey

      Delete Line key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSInsertCharFunctionKey

      NSInsertCharFunctionKey

      Insert Character key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSDeleteCharFunctionKey

      NSDeleteCharFunctionKey

      Delete Character key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSPrevFunctionKey

      NSPrevFunctionKey

      Previous key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSNextFunctionKey

      NSNextFunctionKey

      Next key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSSelectFunctionKey

      NSSelectFunctionKey

      Select key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSExecuteFunctionKey

      NSExecuteFunctionKey

      Execute key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSUndoFunctionKey

      NSUndoFunctionKey

      Undo key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSRedoFunctionKey

      NSRedoFunctionKey

      Redo key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSFindFunctionKey

      NSFindFunctionKey

      Find key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    • NSHelpFunctionKey

      NSHelpFunctionKey

      Help key.

      Available in OS X v10.0 and later.

    • NSModeSwitchFunctionKey

      NSModeSwitchFunctionKey

      Mode Switch key. Not on most Macintosh keyboards.

      Available in OS X v10.0 and later.

    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.

    Import Statement