Constraining 'grab'

Geoff Canyon gcanyon at
Wed Mar 6 10:14:01 EST 2002

At 12:16 AM -0800 3/6/02, Ken Norris (dialup) wrote:
>You're saying that if I drag outside the stack, then the thing I'm over,
>like a menu item, gets the mouseUp message when I release, no matter what
>object script _initiated_ the mouseUp message, unless I take the extra step
>of deliberately killing it? I dunno...that makes no sense to me. Why would
>the mouseUp message get passed to any other object than the one that
>initiated it (unless it was written that way on purpose), as long as the
>mouse is still down in the dragging condition when you get there?
>If this is indeed true, it'll take some serious brain bending for me to get
>used to...mouse things passing messages to other objects that didn't
>originate the handler (without being told to) is just _flat_ illogical.

And that's why it doesn't work that way :-)

The mouseRelease and mouseUp messages are mutually exclusive, and always delivered to the object that received the mouseDown. If you click on a button that contains the script I posted earlier, then that button will receive either a mouseUp or a mouseRelease. If the the pointer is within the button when you let up the mouse button, then the button gets a mouseUp. If not, the button gets a mouseRelease.

If you want the button to do something when the mouse button is released, no matter what, you can either put your code in the mouseUp handler and include this:

on mouseRelease
end mouseRelease

Or, as I did, you can include a third handler that both the mouseUp and mouseRelease call.



More information about the use-livecode mailing list