Reputation: 1201
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
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