Manejo de onMouseOver y onMouseOut en un 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?

preguntado el 09 de enero de 11 a las 05:01

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? -

1 Respuestas

Deberías usar NSTrackingArea objects for these things. This class handles exactly what you need.

Respondido el 09 de enero de 11 a las 09:01

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

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

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.