<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/sendEvent(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(im)sendEvent:"
  },
  "title" : "sendEvent(_:)"
}
-->

# sendEvent(_:)

This action method dispatches mouse and keyboard events the global application object sends to the window.

```
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 isn’t delivered to the corresponding `NSWindow` object. Instead, a [`sendEvent(_:)`](/documentation/AppKit/NSApplication/sendEvent(_:)) message with a window number of `0` delivers it to the NSApplication object.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)