Type Method


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


+ (NSEvent *)mouseEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)wNum context:(NSGraphicsContext *)unusedPassNil eventNumber:(NSInteger)eNum clickCount:(NSInteger)cNum pressure:(float)pressure;



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


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


An integer bit field containing any of the modifier key masks described in Getting Unicode Values, combined using the C bitwise OR operator.


The time the event occurred in seconds since system startup.


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


The display graphics context of the event.


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


The number of mouse clicks associated with the mouse event.


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.

See Also

Creating Events

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

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

+ eventWithEventRef:

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

+ eventWithCGEvent:

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