set the cursor to hand when on links

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Jan 18 10:39:29 EST 2006


Hi André,

Your reply made me understand that, when empty, the mouseChunk could  
pop up an error while the mouseText does not.
Then here a simplified script:

on mouseMove
   switch
   case "button" is in the target
     ShowHandCursor #
     break
   case "field" is in the target and "link" is in the textStyle of  
the mouseText
     ShowHandCursor #
     break
   default
     ResetCursor #
   end switch
end mouseMove
------------------------------
on mouseLeave
   ResetCursor #
end mouseLeave
------------------------------
on ShowHandCursor
   set the cursor to hand
   lock cursor
end ShowHandCursor
------------------------------
on ResetCursor
   unlock cursor
end ResetCursor

Best Regards from Paris,
Eric Chatonet

Le 18 janv. 06 à 13:27, Eric Chatonet a écrit :

> Bonjour André,
>
> Place these handlers in the script of your stack.
> They will manage everywhere the hand cursor for buttons and text  
> links at the same time :-)
>
> on mouseMove
>   switch
>   case "button" is in the target
>     ShowHandCursor #
>     break
>   case "field" is not in the target
>   case the mouseText = empty -- important!
>     exit mouseMove
>     break
>   case "link" is in the textStyle of the mouseChunk
>     ShowHandCursor #
>     break
>   default
>     ResetCursor #
>   end switch
> end mouseMove
> ------------------------------
> on mouseLeave
>   ResetCursor #
> end mouseLeave
> ------------------------------
> on ShowHandCursor
>   set the cursor to hand
>   lock cursor
> end ShowHandCursor
> ------------------------------
> on ResetCursor
>   unlock cursor
> end ResetCursor
>
> FYI: Your script does not work because the mouseText can be empty  
> then the style of the mouseText = the style of nothing and you get  
> an error :-)
> Right?
>
> Best Regards from Paris,
> Eric Chatonet
>
> Le 18 janv. 06 à 12:53, André.Bisseret a écrit :
>
>> I would like the cursor become "hand" instead" of "arrow" when the  
>> mouse is on the links I have in locked flds.
>> (just like it happens in the "see also" in the Rev documentation).
>>
>> For buttons I succeeded with the following handlers in the stack  
>> script :
>> on mouseEnter
>>   if word 1 of the target is "button" then
>>     set the lockCursor to true
>>     set the cursor to hand
>>   end if
>> end mouseEnter
>>
>> on mouseLeave
>>   if word 1 of the target is "button" then
>>   set the lockCursor to false
>> end if
>> end mouseLeave
>>
>> (is there a simpler way to do that ?)
>>
>> But I don't find how to do the same for the links in my locked  
>> fields ;
>> My last trial was :
>>
>> on mouseWithin
>>   if word 1 of the target is "field" then
>>     if the style of the mouseText is "link" then
>>       set the lockCursor to true
>>       set the cursor to hand
>>     end if
>>   end if
>> end mouseWithin
>>
>> but it does'nt work

------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list