Minebomber
Minebomber

Reputation: 1201

Getting mouse position in entire screen Mac OS X

I'm writing a program that needs to get the mouse position in the screen, (not just my view). I need to continuously update variables xPos and yPos. I've heard about subclassing nsview and adding mouseDidMove, but it is never called. (Yes, I set my window view to my custom view.) How can I do this?

Upvotes: 0

Views: 748

Answers (1)

MAH
MAH

Reputation: 1173

You need to set the NSWindow which contains the view to window.acceptMouseMovedEvents = yes. Also if you're just looking for mouse position in the screen consider NSEvent.mouseLocation

Upvotes: 3

Related Questions