Clicking on linked text sends a mouseLeave message?

Jim Hurley jhurley at infostations.com
Thu Jul 24 20:42:33 EDT 2003


>
>Message: 14
>Date: Thu, 24 Jul 2003 18:08:05 -0500
>From: "J. Landman Gay" <jacque at hyperactivesw.com>
>Organization: HyperActive Software
>To: use-revolution at lists.runrev.com
>Subject: Re: Clicking on linked text sends a mouseLeave message?
>Reply-To: use-revolution at lists.runrev.com
>
>On 7/24/03 4:44 PM, Jim Hurley wrote:
>>  The  script below allows students to click on various words ("objective
>>  lens", "ocular lens" etc.) in a "Help field" and an arrow is drawn from
>>  the linked word or phrase to the object in question.
>>
>>  But I want the arrow to go away (set the points of graphic "arrow" to
>>  empty) when the the mouse leaves the  field.
>>
>>   But my handler "mouseLeave" beeps every time I click on a link, the
>>  arrow flashes but immediately disappears.
>>
>>  Why should clicking on a link send a mouseLeave message?
>
>When the arrow graphic appears under the mouse, the field gets a
>"mouseleave" and the graphic gets a "mouseEnter" message. In other
>words, the focus shifts. (This is a new feature of the engine; it didn't
>used to work that way.)
>
>You could work around it by not using the mouseloc as the start of the
>arrow. Add a few pixels to the horizontal position, for example.
>(Although if the user moves the mouse over the graphic, the graphic will
>disappear again.)
>
>--
>Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>HyperActive Software           |     http://www.hyperactivesw.com
>


Jacqueline,

I never would have guess this resolution. Knowing what the problem is 
I can work around it. The following is clumsy but it works:

on mouseLeave
   put 2 into tMargin
   put the mouseV into tY
   put the mouseH  into tX
   if tX - tMargin < item 1 of the rect of me or tY - tMargin < item 2 
of the rect of me then
     set the points of graphic "arrow" to ""
   end if
   if tX + tMargin > item 3 of the rect of me or tY + tMargin > item 4 
of the rect of me then
     set the points of graphic "arrow" to ""
   end if
end mouseLeave

I can't just use "if the mouseLoc is not within the rect of me" since 
it is within the rect just before it leaves.

Thanks much,

Jim



More information about the use-livecode mailing list