unexpected messages
Dave Cragg
dcragg at lacscentre.co.uk
Fri Apr 25 06:38:02 EDT 2003
At 10:27 pm -0700 24/4/03, Bob Rasmussen wrote:
>Whoa! Not so fast! That was "_if_ an extra mousemove gets sent as
>well", which sounds like pure
>speculation to me. "MouseMove", which was the source of my problem,
>isn't mentioned anywhere in any of
>the release notes (which I DO read), and that includes the MetaCard
>release notes.
A mouseMove event is always sent in combination with (and before) a
mouseDown event. I think this may be what you are referring to. It's
been part of the engine behavior as far back as I can remember.
You can check with the following script in a button. Keep the mouse
still, and then click it. (In fact, there now seem to be two
mouseMove messages sent prior to a mouseDown.)
local lvEvents
on mouseUp
put "mouseUp" & cr after lvEvents
put lvEvents
put empty into lvEvents
end mouseUp
on mouseMove
if the mouse is down then put "mouseMove" & cr after lvEvents
end mouseMove
on mousedown
put "mouseDown" & cr after lvEvents
end mouseDown
I'm not defending the rationality of this, but one good outcome is
that it discourages use of "the mouse" function to determine whether
the mouse is down when you want to track mouse movement.
For those new to the list (this issue crops up regularly), the
"proper" way is to set a flag (as a script local or custom property)
on mouseDown and reset it on mouseUp. Then in the mouseMove handler,
check the state of the flag, and *not* the mouse function.
Cheers
Dave
More information about the use-livecode
mailing list