Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:53:07+00:00 2026-06-09T05:53:07+00:00

I thought I would post a question and answer regarding continuously tracking the mouse

  • 0

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 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:53:08+00:00Added an answer on June 9, 2026 at 5:53 am

    heres how I did it.

    First of all this is the code I used to set up the tracking area :

    NSTrackingArea* trackingArea = [ [ NSTrackingArea alloc] initWithRect:[ mainWindow frame]       options:(NSTrackingMouseMoved | NSTrackingActiveAlways ) owner:self userInfo:nil);
    
    [container addTrackingArea:trackingArea];
    

    When I create the main window I add this message while i’m setting everything up :

     [window setAcceptsMouseMovedEvents:YES];
    

    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.

    -(void) mouseMoved: (NSEvent *) thisEvent
    {
      NSPoint cursorPoint = [ thisEvent locationInWindow ];
      NSLog(@"X coordinate is %f and Y coordinate is %f",cursorPoint.x,cursorPoint.y);
    }
    

    Hope this is of some help 🙂

    Thanks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I would post this here not so much as a question but
Recently I posted a answer to a question that I thought was quite an
I would have thought this would be super easy to find an answer to
Someone recently asked me this question and I thought I'd post it on Stack
After Jeph most recent post: http://www.codinghorror.com/blog/archives/001310.html , I thought to myself it would be
This is what I thought would be a simple select clause, however the following
I am looking to do something I thought would be fairly straight forward, Adding
I'm being stymied by what I thought would be the relatively simple task of
I am trying to Emit what I thought would be a simple object array
I am having problems finding a solution for what I thought would be straight

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.