Wierd MouseLine

Dave Cragg dave.cragg at lacscentre.co.uk
Wed Mar 25 04:53:27 EDT 2009


On 24 Mar 2009, at 22:58, dunbarx at aol.com wrote:

> If not a bug, then a gremlin.
>
> In a stack, make a locked field with several lines of text. In the  
> field
> script put:
>
> on mouseUp
>   set cursor to plus
>   repeat until the mouseClick
>     put the mouseLine
>   end repeat
> end mouseUp
>
> Move the mouse over the various lines in the field. You will get  
> feedback
> about the line the mouse is over. However, if you move the mouse  
> outside of the
> field, and move around so the mouseV corresponds to the "V" of lines  
> of the
> field, you also get the same info. This only works (?) for the  
> mouseLine. All the
> other mouseFunctions, like mouseChunk, only report the actual  
> underlying text
> info.

I'd guess it's a gremlin. :-)

I'm always wary of using a repeat loop that waits for an event. I'm  
never sure what should happen to events that would normally get fired  
before the event that's being waited for. (mouseleave, etc) So there's  
some uncertainty (in my mind at least) of what the current "target" is.

The following script, whether placed in the field's script or the  
card's script seems to behave as you would expect.

local sTracking = false

on mouseUp
   put not sTracking into sTracking
end mouseUp

on mouseMove
    if sTracking then
       put the mouseLine
    end if
end mouseMove


Cheers
Dave



More information about the use-livecode mailing list