mouseEnter-Leave conundrum

Devin Asay devin_asay at byu.edu
Mon May 14 17:19:10 EDT 2007


On May 14, 2007, at 3:01 PM, J. Landman Gay wrote:

> J. Landman Gay wrote:
<snip>
>
> I just tried it with multiple fields and graphics. You need this  
> version:
>
> local sObj
>
> on mouseEnter
>   if the name of the target contains "graphic" then
>     if sObj <> "" then
>       put last char of of the short name of sObj into tNum
>       hide fld ("field"&tNum)
>     end if
>     put the name of the target into sObj
>   end if
> end mouseEnter
>
> on mouseMove x,y
>   if sObj = "" then pass mouseMove
>   put last char of of the short name of sObj into tNum
>   if x,y is not within the rect of sObj then
>     hide fld ("field"&tNum)
>     put "" into sObj
>   else
>     show fld ("field"&tNum)
>   end if
> end mouseMove
>
> I'm afraid you do lose the fine distinction between "the rect" of  
> the graphic and its actual outline, but the behavior comes close to  
> what you want I think.

In turns out all you have to do is use the within() function. That  
looks at the actual outline of the graphic instead of the rect. I  
didn't realize until today that the 'is within' operator and the  
'within()' function have this subtle difference. Very cool.

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list