Instance Method

sendEvent(_:)

This action method dispatches mouse and keyboard events sent to the window by the NSApplication object.

Declaration

func sendEvent(_ event: NSEvent)

Parameters

event

The mouse or keyboard event to process.

Discussion

Never invoke this method directly. A right mouse-down event in a window of an inactive application is not delivered to the corresponding NSWindow object. It is instead delivered to the NSApplication object through a sendEvent(_:) message with a window number of 0.

See Also

Handling Events

class func menuChanged(NSMenu)

This method does nothing; it is here for backward compatibility.

Deprecated
var currentEvent: NSEvent?

The event currently being processed by the application.

func nextEvent(matching: NSEvent.EventTypeMask) -> NSEvent?

Returns the next event matching a given mask.

func discardEvents(matching: NSEvent.EventTypeMask, before: NSEvent?)

Forwards the message to the NSApplication object, NSApp.

func postEvent(NSEvent, atStart: Bool)

Forwards the message to the global NSApplication object, NSApp.

func tryToPerform(Selector, with: Any?) -> Bool

Dispatches action messages with a given argument.