jox
jox

Reputation: 82

mouseMoved not called when over the View

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

Upvotes: 3

Views: 3692

Answers (3)

kperryua
kperryua

Reputation: 10534

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.

Upvotes: 5

Kiraya
Kiraya

Reputation: 11

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

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

set acceptMouseMovedEvents to yes:

 [fullScreenWindow_ setAcceptsMouseMovedEvents:YES];

Upvotes: 1

Tim Dean
Tim Dean

Reputation: 8292

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

Upvotes: 2

Related Questions