I thought I would post a question and answer regarding continuously tracking the mouse location in cocoa ( in OSX 10.5.8 using xcode 3.1.4) within a cocoa app.
It is a self answer question because I finally figured it out and couldn’t find an answer here that I thought described how I managed to solve it
And possibly some people might think its easier than using event taps plus without the masking features in 10.6 this is pretty easy 🙂
heres how I did it.
First of all this is the code I used to set up the tracking area :
When I create the main window I add this message while i’m setting everything up :
and in the header file for the class that I want to catch the event (which for me is in the same class as I created the tracking area ) I subclass NSResponder and then implement the event I want to catch which for me is mouseMoved.
Hope this is of some help 🙂
Thanks!