Cursor questions

Peter Brigham MD pmbrig at gmail.com
Fri Mar 19 08:15:37 EDT 2010


On Mar 18, 2010, at 6:56 PM, Sarah Reichelt wrote:

>> Second, is it possible for me to detect that the mouse is over a  
>> link and change the cursor to something else (i.e. the hand icon/ 
>> cursor)? I know there's changes coming w/ 4.5 that look promising.  
>> I haven't bothered to download the developer preview as I really  
>> don't want to risk is, but if some of these concerns go away with  
>> 4.5 and someone can just email me them (instead of breaking NDA on  
>> the list), that'd be fine, too. (massung at gmail.com).
>
> This doesn't require 4.5, so no NDA conflict here.
>
> I put this in a card script and it seems to work fine:
>
> on mouseMove
>   if word 1 of the target = "field" then
>      if the textStyle of the mouseText contains "link" then
>         lock cursor
>         set the cursor to hand
>      else
>         unlock cursor
>      end if
>   end if
>
>   pass mouseMove
> end mouseMove

I prefer to set the defaultcursor to hand or to empty instead of  
locking and setting the cursor. Whenever I've tried to use lock cursor  
I've ended up having intermittent frozen cursor problems. Also, you  
might want to put in a "if the locktext of the target then..." test,  
or you'll get the cursor changing over links in unlocked fields, and  
when the cursor changes to hand the user will think the link is  
clickable -- but it won't be.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list