unexpected messages
Bob Rasmussen
brasmussen at earthlink.net
Sun Apr 27 14:16:01 EDT 2003
Dave Cragg <dcragg at lacscentre.co.uk> wrote:
> . . .
>
> 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.
The object I hid was a group that wasn't in the message path.
My script was in the stack, not in the target.
>
> (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.)
>
In my case the "mouseDown" script was suspended only long enough for the "hide" command to work.
>
> 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.
The object I hid was not the original target or any of the nested groups containing it.
> 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.
>
> Cheers
> Dave
What you observed sounds similar to what I reported. There are apparently several ways to get
this behavior.
What I was trying to do (have done actually) is duplicate drag behavior like you see for
instance in the MacOS Finder. While moving an icon, the original stays behind and a
semi-transparent copy moves with the mouse cursor. On releasing the mouse button, the original
icon moves to the last location of the copy.
The way I was doing things, the copy needed to stay hidden until the mouse moved, so I created
it and hid it right away with the idea of showing it again when "mouseMove" was called. Because
the unexpected "mouseMove" happened before I had saved the name of the copy, the "mouseMove"
message was trying to show and move an object referred to by a variable that was still empty.
Once I worked out the reason, the fix was simply reordering a couple statements.
Hence my original request. I knew a "mouseMove" was coming from somewhere inside the
"mouseDown" handler, but where? It was a large handler. If I had had a place to look for all
the ways a "mouseMove" can get generated, that would have been much easier. Instead I had to
zero in with bracketing "put" statements. I can foresee similar situations arising in the
future, so a general list seems in order.
Thanks again for the feedback.
RR
p.s. Sorry for not fixing the Subject line in my last post.
More information about the use-livecode
mailing list