mouseMoved not called when over the View
-
24-12-2020 - |
Question
I have subclass of NSView which implements mouseMoved.
However when I move my mouse over the view the mouseMoved never gets called. Why?
I am on OS X Lion.
Thanks, Vance
Solution
Even with -setAcceptsMouseMovedEvents:, your view will only get -mouseMoved: when it is the first responder. If you want to receive mouse moved events when your view isn't first responder, give NSTrackingArea a look.
OTHER TIPS
Try enabling mouseMoved events on the window containing the view via the NSWindow class's setAcceptsMouseMovedEvents: method
i solved this problem by putting this hack in the CCDirectorMac: after:
[fullScreenWindow_ makeMainWindow];
[fullScreenWindow_ makeKeyAndOrderFront:self];
set acceptMouseMovedEvents to yes:
[fullScreenWindow_ setAcceptsMouseMovedEvents:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow