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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:10:57+00:00 2026-06-12T07:10:57+00:00

How can I update NSCursor whenever I need? I implemented resetCursorRects method. In resetCursorRects

  • 0

How can I update NSCursor whenever I need? I implemented resetCursorRects method. In resetCursorRects I create image with needed size (size depends on slider value in my app) and make cursor with that image. So if my slider, witch declares needed cursor size, is being changed, I need my cursor to be updated. So if thinking logically, calling [self resetCursorRects] should work, but it doesn’t. After changing slider value and for example resizing window, cursor updates. But why it doesn’t updates when I try to call it?

  • 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-12T07:10:59+00:00Added an answer on June 12, 2026 at 7:10 am

    For this purpose you should implement

    @property (nonatomic, retain) NSArray *cursors;
    

    in your .h file and something like:

    - (void)loadCursors
    {
        NSCursor *defaultCursor = [[NSCursor alloc] initWithImage:[NSImage imageNamed:DEFAULT_CURSOR] hotSpot:NSMakePoint(2, 0)];
        NSAssert(defaultCursor, @"defaultCursor failed to load");
        NSCursor *clickedCursor = [[NSCursor alloc] initWithImage:[NSImage imageNamed:CLICKED_CURSOR] hotSpot:NSMakePoint(2, 0)];
        NSAssert(clickedCursor, @"clickedCursor failed to load");
        NSCursor *draggingCursor = [[NSCursor alloc] initWithImage:[NSImage imageNamed:DRAGGING_CURSOR] hotSpot:NSMakePoint(17, 2)];
        NSAssert(draggingCursor, @"draggingCursor failed to load");
    
        self.cursors = [NSArray arrayWithObjects:defaultCursor, clickedCursor, draggingCursor, nil];
    
        [defaultCursor release];
        [clickedCursor release];
        [draggingCursor release];
    
        [self resetCursorRects];
    }
    
    - (void)setCursor:(NSUInteger)cursorIndex
    {
        [self discardCursorRects];
    
        [self addCursorRect:self.bounds cursor:[self.cursors objectAtIndex:cursorIndex]];
        [(NSCursor *)([self.cursors objectAtIndex:cursorIndex]) set];
    }
    
    - (void)resetCursorRects
    {
        [self setCursor:CursorTypeDefault];
    }
    

    and use these methods in something like:

    - (void)mouseDown:(NSEvent *)theEvent
    {    
        [self setCursor:CursorTypeClicked];
    }
    

    or wherever you want.

    Don’t forget to implement Enum with your cursor and to load cursors in your init method!

    Hope this helps.

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

Sidebar

Related Questions

I need a document based database where I can update single documents but when
I was wanting to create a small tool in Delphi which can update the
I tried to create my own JTree Model so I can update the graphics
I am looking for a generic stored procedure that can update any field value
In WPF, we can update the underlying data model whenever the user makes any
How can update a input hidden inside an UpdatePanel on an AsyncPostBack? The user
I want to understand how I can update my GUI with a simple text
I am trying to figure out how I can update my sql query dynamically.
I was wondering how GMail and things like that can update the emails in
I am having trouble figuring out how i can update the background of my

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.