mouseLeave and linked text question

Jeanne A. E. DeVoto revolution at
Mon Feb 28 17:08:09 EST 2005

At 12:48 PM -0800 2/18/05, Mark Swindell wrote:
>Can someone explain the following?  In the script below, in the 
>first if/then structure, the mouse moving away from a piece  of 
>linked text causes the backgroundColor of that linked text to reset 
>to empty.  But the mouse is only moving off the linked text, not out 
>of the field.  This makes me think a piece of linked text is a 
>control which receives a mouseLeave message.  Is this correct?
>But then with the repeat structure below that, only by the mouse 
>actually leaving the field does the backgroundColor of all lines 
>reset to empty.  Which leads me to think that the linked text it was 
>hovering over was not a control.
>How does this work?
>on mouseLeave
>   -- unhighlight any currently highlighted text:
>   if storedHilitedChunk is not empty then
>     do "set the backgroundColor of" && \
>         storedHilitedChunk && "to empty"
>     put empty into storedHilitedChunk
>   end if
>   repeat with y = 1 to 3
>     repeat with x = 1 to the number of lines of field y
>       set the backgroundColor of line x of field y to empty
>     end repeat
>   end repeat
>   pass mouseLeave
>end mouseLeave

Sorry I'm seeing this and responding so late. The above looks like a 
mutation of the highlight-text script that I wrote for the original 

The mouseLeave handler actually *isn't* invoked when you move the 
mouse off of linked text but leave it inside the field. Take a look 
in the script for the companion mouseMove handler, which has some 
similar code. The mouseMove handler, not mouseLeave, controls the 
unhighlighting in this case.

The mouseLeave handler is in the way of being a backup, to make sure 
that moving the mouse quickly out of the field doesn't leave 
"highlight droppings" if the mouse is moving too fast to trigger 
mouseMove before it leaves the field.
jeanne a. e. devoto ~ revolution at

More information about the use-livecode mailing list