otherEvent(with:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:)
Creates and returns a new event object that describes a custom event.
Declaration
class func otherEvent(with type: NSEvent.EventType, location: NSPoint, modifierFlags flags: NSEvent.ModifierFlags, timestamp time: TimeInterval, windowNumber wNum: Int, context unusedPassNil: NSGraphicsContext?, subtype: Int16, data1 d1: Int, data2 d2: Int) -> NSEvent?Parameters
- type:
One of the following event-type constants:
NSAppKitDefinedNSSystemDefinedNSApplicationDefinedNSPeriodic
If
typeis anything else, anNSInternalInconsistencyExceptionis raised. Your code should only create events of typeNSApplicationDefined. - 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
Getting Unicode Values, combined using the C bitwise OR operator. - time:
The time the event occurred in seconds since system startup.
- wNum:
An integer that identifies the window device associated with the event, which is associated with the
NSWindowthat will receive the event. - unusedPassNil:
The display graphics context of the event. Pass
nilfor this parameter. - subtype:
A numeric identifier that further differentiates custom events of types
NSAppKitDefined,NSSystemDefined, andNSApplicationDefined.NSPeriodicevents don’t use this attribute. - d1:
Additional data associated with the event.
NSPeriodicevents don’t use these attributes. - d2:
Additional data associated with the event.
NSPeriodicevents don’t use these attributes.
Return Value
The created NSEvent object or nil if the object couldn’t be created.
See Also
Related Documentation
Creating an event object
keyEvent(with:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:)mouseEvent(with:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:)enterExitEvent(with:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:)init(eventRef:)init(cgEvent:)