2

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

Tim Dean
  • 8,253
  • 2
  • 32
  • 59
jox
  • 74
  • 2
  • 8

3 Answers3

4

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.

vy32
  • 28,461
  • 37
  • 122
  • 246
kperryua
  • 10,524
  • 1
  • 38
  • 24
2

Try enabling mouseMoved events on the window containing the view via the NSWindow class's setAcceptsMouseMovedEvents: method

Tim Dean
  • 8,253
  • 2
  • 32
  • 59
  • I do try to set "[pullDownWindow setAcceptsMouseMovedEvents:YES];" on the NSWindow instance the view is part of but still nothing. Is there something else? – jox Aug 11 '11 at 04:19
1

i solved this problem by putting this hack in the CCDirectorMac: after:

 [fullScreenWindow_ makeMainWindow];
 [fullScreenWindow_ makeKeyAndOrderFront:self];

set acceptMouseMovedEvents to yes:

 [fullScreenWindow_ setAcceptsMouseMovedEvents:YES];
Origin
  • 2,009
  • 5
  • 19
  • 19
Kiraya
  • 11
  • 1