Search code examples
objective-ccocoamacosnsviewnsstatusitem

Handling onMouseOver and onMouseOut on a NSStatusItem


I have a status menu with a few items inside of all. All of the status items are custom and have custom views inside.

How do I detect when the user's mouse is over the NSView (inside of the item) or status item itself?


Solution

  • You should use NSTrackingArea objects for these things. This class handles exactly what you need.