I have a cocoa application that has a view which is clickable. I cannot figure out how to change the cursor when the user mouses over it. I want to do this so that the user knows that they can click on it. I know this should be very simple, but I have not been able to find anything via google or stackoverflow. Anyone have any ideas?
So, not this?
Cocoa: change cursor when it's over an NSButton
[yourButton addCursorRect:[yourButton bounds] cursor:[theCursorYouWant]];
(Quote from Mark)
This is a relatively simple thing to do using NSView
's tracking areas methods in conjunction with the NSCursor
class to change the cursor. In general, the way you do this is set up a tracking area for your view, and when you get mouseEntered
and mouseExited
updates from the tracking area, you can update the cursor.
Check out the NSView Class Reference and the NSCursor Class Reference for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With