Changing cursor over a clickable object

Ok another question: I have set up a clickable image by using a borderless button. But I’d like to cue a user that there’s something there to be clicked, and I want to use a “hand” cursor as the hint when the cursor is moved over the image (button). Is this possible within the realm of AppleScript Studio?

(Searched both this forum and AS lists, but no answer)

Thanks.

I know Jon’s Commands Scripting Addition has a command for changing the cursor and I’m sure there’s a method you could call but it doesn’t appear that AppleScript Studio supports a call to change the cursor from AppleScript alone. Still, there are lot of things you could do. The easiest is to do something like toggle the button border when the cursor is over the button. To make this work, in IB, enable the “mouse entered” and “mouse exited” AppleScript handlers for the borderless button. Then, in your script, add this code:

on mouse entered the_object event the_event
    set bordered of the_object to true
end mouse entered

on mouse exited the_object event the_event
    set bordered of the_object to false
end mouse exited

Jon

I know Jon’s Commands Scripting Addition has a command for changing the cursor and I’m sure there’s a method you could call but it doesn’t appear that AppleScript Studio supports a call to change the cursor from AppleScript alone. Still, there are lot of things you could do. The easiest is to do something like toggle the button border when the cursor is over the button. To make this work, in IB, enable the “mouse entered” and “mouse exited” AppleScript handlers for the borderless button. Then, in your script, add this code:

on mouse entered the_object event the_event
     set bordered of the_object to true
end mouse entered

on mouse exited the_object event the_event
     set bordered of the_object to false
end mouse exited

Jon

Yes I did try Jon’s (another Jon?) commands but it triggered my classic environment so I stopped it. The code seems to be a bit dated…

Anyway thanks for the suggestion.

Jon’s Commands are live and good-healthy:
http://www.seanet.com/~jonpugh/
However, the “set cursor to” command doesn’t provide a “hand cursor”. I’ve tried some integers, but it doesn’t show. You could embed your own hand into an “acur” resource (as stated in the documentation), but it would work only from an applet. I don’t know how could you embed res-fork in an AS-Studio app, thought seems it could be done (if you see, some apps have resource-fork files within its resources bundle, eg “Internet Explorer”, but I don’t know how they are called or connected to your app).

In Mac OS X 10.3, Apple says you can call various cursors using methods for modifying the NSCursor object (see http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSCursor.html#//apple_ref/occ/cl/NSCursor). I’m sure there’s a way to call this method from within AppleScript Studio or to write your own Obj-C method called by a script but I don’t have the time to do it. Still, if someone else had the time, I’d love to see it done.

Jon