Change cursor

Hey there,

Quick question I’m sure some of you can help me out with…
So, off we go: How do I turn my default cursor into the systems-default hand with a pointing finger. (need it for a hover effect)
I’m running Mac OS X 10.7 by the way.

Thank you very much!

Cheers,

Ramon

I am not sure about a proper way to do this. However, I can think of a workaround.

If you can get the onHover event, use ofHideCursor(); to hide the mouse pointer and draw an image which looks similar to the hand cursor at mouseX, mouseY. :slight_smile:

You can get back the original cursor with ofShowCursor();

Cheers!

try
for the pointing hand

  
  
[[NSCursor pointingHandCursor] set];  
  

and for the normal arrow:

  
  
[[NSCursor arrowCursor] set];  

you’ll have to rename your file from .cpp to .mm, so XCode knows that it has to compile the file with the ObjC+±compiler. Perhaps you’ll have to add

  
  
#import <Cocoa/Cocoa.h>  
  

at the beginning of your file.

Works only for OS X, untested with OpenFrameWorks, YMMV.

cheers,
Stephan

@lahiru:
Thanks for thinking along, was working on something that myself but wanted to know if there actually was another way.

@sth:
Wow, amazing, thanks very much, totally fits my needs!

Ah! Now thats the proper way to do it. Thanks @sth! :slight_smile: