0

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?

Andrew M
  • 4,208
  • 11
  • 42
  • 67
  • Hey Andrew, I am running into the same problem, but can't get the NSTrackingArea to respond to event. Would you mind updating the question with your solution? – coneybeare Jul 17 '12 at 13:06

1 Answers1

1

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

Eimantas
  • 48,927
  • 17
  • 132
  • 168
  • Looks perfect. I was looking around but I couldn't find out how to actually RECEIVE the event. I can set up the tracking area, but what gets called or how do you set something to be called? – Andrew M Jan 09 '11 at 06:16
  • You setup NSTrackingArea with needed to receive events (mouse entered/left/hovered/etc) and owner of these events (like view or its controller) which should implement required methods like `mouseEntered:`, `mouseExited:`, `mouseMoved:` or `cursorUpdate:`. – Eimantas Jan 09 '11 at 06:29