unexpected messages

Dave Cragg dcragg at lacscentre.co.uk
Sun Apr 27 05:53:01 EDT 2003

At 9:46 pm -0700 26/4/03, Bob Rasmussen wrote:

>I genuinely appreciate the effort Dave, but that's still not the case I
>reported.  The "mouseMove" message that your example demonstrates does indeed
>occur before the "mouseDown".  However, the extra one I observed occurred
>*after* the "mouseDown" had already executed several statements and before the
>remaining statements in the "mouseDown" handler completed.  It happened, in
>fact, coincident with a "hide" statement *inside* the "mouseDown" handler.  I
>know this, because my handlers looks something like the following after a few
>diagnostic items are added akin to your example:
>     local lvEvents, mouseIsDown
>     on mouseDown
>       put true into mouseIsDown
>       put "mouseDown enter" & cr after lvEvents
>       -- several statements, which among other things makes a new group within
>an existing group using a "copy" command
>       put "before hide" & cr after lvEvents
>       hide anObject
>       put "after hide" & cr after lvEvents
>       -- several more statements
>       put "mouseDown exit" & cr after lvEvents
>     end mouseDown
>     on mouseMove h, v
>       if mouseIsDown then
>         put "mouseMove     <--" & cr after lvEvents
>         -- several more statements
>       end if
>     end mouseMove
>     on mouseUp
>       put false into mouseIsDown
>       put "mouseUp" & cr after lvEvents
>       put lvEvents
>       put empty into lvEvents
>       -- several more statements
>     end mouseUp
>What shows up in the message box is this:
>     mouseDown enter
>     before hide
>     mouseMove     <--
>     after hide
>     mouseDown exit
>     mouseMove     <--
>     mouseMove     <--
>     mouseMove     <--
>     mouseUp
>Take a look at the third line.  I hope this makes my situation clearer now.

I just sent a reply agreeing that this was a puzzler, but saying I 
couldn't reproduce it. But I put the wrong address on the mail, so 
it's waiting moderator approval.

Meanwhile, I was able to produce some similar behavior so ignore the 
other reply if it comes in later.

I found that if the target of the mouseDown is also the object that 
is getting hidden, and the script is in a group that contains the 
target then you will get the seemingly out of sync mouseMove message. 
(But the target of the mouseMove messages is the group, not the 
target of the mouseDown message.) It's as if the target object's 
mouseDown script is suspended until something happens to bring it 
back again. (In my case, releasing the mouse over an other object in 
the group that was contained with the rect of the hidden object.)

If this is akin to your situation, then I agree it's odd. However, 
after hiding the target object in a mouseDown, I'm not sure I'd know 
what behavior to expect for subsequent mouse messages. I don't know 
what problems this is causing your particular application, but 
checking the target of the mouseMove messages in a group script might 
be the way to only handle the ones you need.


More information about the use-livecode mailing list