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 7616341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:51:50+00:00 2026-05-31T02:51:50+00:00

I am developing an application with a custom view where the user is able

  • 0

I am developing an application with a custom view where the user is able to move objects around the view. They can pick them up and put them in different places and I want to cursor to change depending on what objects they can pick-up and where they can put them.

I am using tracking areas, but in order to maintain the correct cursors I am using tracking area notifications and setting the cursor for any mouse movement.

This is working well and I have my solution, but I wanted to know if there was a performance penalty for calling [NSCursor set] so often or if AppKit is able to handle this without issue?

Update: As advised by Rob Keniger I have profiled the application and didn’t see any real amount of time spent changing cursors. Just to be safe, I have implemented a simple macro that keeps the current cursor state and only sets it if necessary, as defined here:

// Values for _currentCursor
#define CURRENT_CURSOR_UNKNOWN      0
#define CURRENT_CURSOR_ARROW        1
#define CURRENT_CURSOR_POINTINGHAND 2
#define CURRENT_CURSOR_OPENHAND     3
#define CURRENT_CURSOR_CLOSEDHAND   4
#define CURRENT_CURSOR_NOENTRY      5

#define CURRENT_CURSOR_HIDDEN       0x80

#define SET_CURSOR(current, cursor) \
if ((_currentCursor & CURRENT_CURSOR_HIDDEN) == 0 && _currentCursor != current) \
{ \
   [cursor set]; \
    _currentCursor = current; \
}

You would invoke this in code thus:

SET_CURSOR(CURRENT_CURSOR_CLOSEDHAND, [NSCursor closedHandCursor]);
  • 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-05-31T02:51:51+00:00Added an answer on May 31, 2026 at 2:51 am

    Firstly, with regards to performance, have you tested it? Apple provides excellent tools for profiling. With Instruments you’ll very quickly find out how much of a performance hit the cursor changing calls are causing. Don’t guess, profile.

    Secondly, why are you not using the mouseEntered: and mouseExited: events to change the cursor, rather than the mouseMoved: event? Most of the time, the only time the cursor needs to change is when the mouse enters or exits a tracking area, right?

    If you do need finer-grained control (for instance, I could see this might be the case if you’re needing to select a non-rectangular object) and if the cursor change call turns out to be expensive (I very much doubt it), you should just store the current state of the cursor and in the mouseMoved: event, check to see if the cursor needs to change and then change it if so.

    However, I suspect that what you’re already doing will turn out to be just fine, as NSCursor probably does a similar check if you call [NSCursor set] with the same cursor as the current cursor.

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

Sidebar

Related Questions

I'm developing web application using CodeIgniter. All this time, I put the custom js
I am developing an iPhone application, in my table view I wanted custom color
I am developing a Silverlight application with custom animations. I want to update the
I am developing an application for PocketPC. When the application starts the custom function
I am developing an iphone application which have a complicated view is to display
Question for you all, I've been charged with developing an application to view data
i'm developing a window form application. i'm in need of placing custom control comprising
Basically I'm developing application using asp.net and I want to write Custom validator which
I am developing an application that has a few custom overlays on a MapView
I'm developing an application in Silverlight2 and trying to follow the Model-View-ViewModel pattern. I

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.