---
title: "sendEvent(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindow/sendevent(_:)"
---

# sendEvent(_:)

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

## Declaration

```swift
func sendEvent(_ event: NSEvent)
```

## Parameters

- `event`: The mouse or keyboard event to process.

## Discussion

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(_:) message with a window number of 0 delivers it to the NSApplication object.

## See Also

### Handling Events

- [currentEvent](appkit/nswindow/currentevent.md)
- [nextEvent(matching:)](appkit/nswindow/nextevent(matching:).md)
- [nextEvent(matching:until:inMode:dequeue:)](appkit/nswindow/nextevent(matching:until:inmode:dequeue:).md)
- [discardEvents(matching:before:)](appkit/nswindow/discardevents(matching:before:).md)
- [postEvent(_:atStart:)](appkit/nswindow/postevent(_:atstart:).md)
- [tryToPerform(_:with:)](appkit/nswindow/trytoperform(_:with:).md)
