Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

NSEvent Class Reference

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

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

Adopted Protocols

NSCoding
NSCopying

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

Class Methods

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
See Also
Declared In
NSEvent.h

eventWithEventRef:

Creates an NSEvent 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
See Also
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
See Also
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 “Constants,” 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
See Also
Declared In
NSEvent.h

mouseLocation

Reports the current mouse position in screen coordinates.

+ (NSPoint)mouseLocation

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
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
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
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
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 ("´").

Availability
See Also
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 nonkey 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.

Availability
See Also
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 nonmouse 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
See Also
Declared In
NSEvent.h

context

Returns the display graphics context of the receiver.

- (NSGraphicsContext *)context

Availability
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
See Also
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
See Also
Declared In
NSEvent.h

deltaX

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

- (CGFloat)deltaX

Availability
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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 nonkey event.

Availability
See Also
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
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
See Also
Declared In
NSEvent.h

locationInWindow

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

- (NSPoint)locationInWindow

Discussion

For nonmouse 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
See Also
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
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
See Also
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
See Also
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
See Also
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 nonmouse 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
See Also
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
See Also
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 Mac OS X v10.4 and later. See “Constants” for the predefined mouse and tablet subtypes.

Availability
See Also
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
See Also
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
See Also
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
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
See Also
Declared In
NSEvent.h

timestamp

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

- (NSTimeInterval)timestamp

Availability
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-Mac 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
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 Mac OS X version 10.5

Availability
See Also
Declared In
NSEvent.h

type

Returns the type of the receiving event.

- (NSEventType)type

Discussion

The type must be one of the following: