Returns a new NSEvent object describing a custom event.
SDK
- macOS 10.0+
Framework
- App
Kit
Declaration
+ (NSEvent *)otherEventWithType:(NSEvent Type)type location:(NSPoint)location modifierFlags:(NSEvent Modifier Flags)flags timestamp:(NSTime Interval)time windowNumber:(NSInteger)wNum context:(NSGraphics Context *)unusedPassNil subtype:(short)subtype data1:(NSInteger)d1 data2:(NSInteger)d2;
Parameters
type
One of the following event-type constants:
NSApp
Kit Defined NSSystem
Defined NSApplication
Defined NSPeriodic
If
type
is anything else, anNSInternal
is raised. Your code should only create events of typeInconsistency Exception NSApplication
.Defined location
The cursor location in the base coordinate system of the window specified by
window
.Num flags
An integer bit field containing any of the modifier key masks described in Getting Unicode Values, 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
NSApp
,Kit Defined NSSystem
, andDefined NSApplication
.Defined 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.