Constraining 'grab'

Scott Rossi scott at
Thu Mar 7 04:06:01 EST 2002

Recently, Ken Norris (dialup) wrote:

> How do you release the mouse button outside an object you're dragging? By
> definition, it is within the dragged object, so it's a "mouseUp" situation,
> unless you "beat the clock" by deliberately moving the cursor so fast that
> the dragged object can't catch up, and are able to release the mouse button
> before it does.

The above situation is quite common.  This is why you must have a
mouseRelease handler among your scripts.  I think Geoff already explained
this, but here are some more examples:

1) Like your example above, a very large or translucent object almost NEVER
follows the mouse precisely; there is always a lag while the object tries to
keep up with the mouse position, thus it is possible to release the mouse
while it falls outside the rect of the dragged object.

2) If you drag an object but your cursor moves beyond the edge of the
application window, your mouse no longer falls within the rect of the
dragged object.

3) If you drag an object to the edge of a constraining region, the cursor
will move outside the rect of the dragged object.

The drag sample stack illustrates item 3 above.  If you still have not
downloaded this stack, do so.  You'll probably find it useful.


Scott Rossi
Creative Director

Tactile Media, Multimedia & Design
Email: scott at

More information about the use-livecode mailing list