Unable to change the cursor

Hello.

Well, there is no [NSView setCursor: myCursor]. Definitely NOT. It’s simply incredible all you have to do to get a so common behavior!

First, I declare a NSTrackingArea inside the NSView initialization, like this:

Note that it took me one hour to understand the engineers’ language about the “options”. They must be combined. Then, as I wanted only the cursor update option, I implemented the cursorUpdate handler:

Then, in doubt – there are many doubts-- the resetCursorRects:

See, about ten lines to get a stupid cursor. and it does not work. What did I missed, or what’s wrong with this code?

That’s the kind of things that make me regret the good old days of QuickDraw. You could even define your cursors as resources, and fix the hot spot. Why are things becoming always more complicated? Why? :rolleyes:

Why not creating a setCursor yourself?

subclass of NSView put it somewhere in your window and enjoy the show :smiley:

two problems:

replace self.frame with [self bounds].
btw: I recommend to use dot notation only if the receiver is explicitly declared as a property

replace NSTrackingActiveWhenFirstResponder+NSTrackingCursorUpdate with NSTrackingActiveInActiveApp | NSTrackingCursorUpdate

Combining masked constants you should use the boolean operator | rather than the numeric operator +
Without NSTrackingActiveInActiveApp you have to make the custom view first responder

Calling the method resetCursorRects is actually not necessary

Hi DJ,

Well, I succeed finally using the standard methods. Guess what? I just had to restart the Mac and everything is working. So: Clean Project: taradiddles. Restart Xcode: hot air. Restart Finder: nuts. Restart the Mac: whoopee.

Ah, and I was talking about the good old days. :smiley:

Hi, Stefan: You know what? I had already done two of your three changes (bounds and delete resetRects) before I read your post. I’m making progress. :confused:

EDIT : but thanks for the options of NSTracking. This doc can be unbearable. :mad: