---
title: "setOnMouseEntered(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscursor/setonmouseentered(_:)"
---

# setOnMouseEntered(_:)

Specifies whether the receiver accepts mouseEntered(with:) events.

## Declaration

```swift
func setOnMouseEntered(_ flag: Bool)
```

## Parameters

- `flag`: doc://com.apple.documentation/documentation/Swift/true if the receiver accepts future doc://com.apple.appkit/documentation/AppKit/NSCursor/mouseEntered(with:) event messages; otherwise it ignores them.

## Discussion

Discussion Accepting mouseEntered(with:) event messages allows the cursor to be made the current cursor when the cursor enters a view’s cursor rectangle.

## See Also

### Deprecated

- [init(image:foregroundColorHint:backgroundColorHint:hotSpot:)](appkit/nscursor/init(image:foregroundcolorhint:backgroundcolorhint:hotspot:).md)
- [mouseEntered(with:)](appkit/nscursor/mouseentered(with:).md)
- [isSetOnMouseEntered](appkit/nscursor/issetonmouseentered.md)
- [mouseExited(with:)](appkit/nscursor/mouseexited(with:).md)
- [setOnMouseExited(_:)](appkit/nscursor/setonmouseexited(_:).md)
- [isSetOnMouseExited](appkit/nscursor/issetonmouseexited.md)
