Constraining 'grab'

Ken Norris (dialup) pixelbird at interisland.net
Wed Mar 6 03:06:01 EST 2002


on 3/5/02 8:38 PM, Geoff Canyon at gcanyon at inspiredlogic.com wrote:

> It can be several things. Your suggestion might be one, another might be if
> they drag the pointer outside the stack, into the menubar, etc.
----------
Ahh, yes, I see, said the blindMan. Are you saying 'grab' doesn't carry the
drag activity with it outside the stack? I'm trying understand differences
to HC.

In HC, using this button routine:

on mousestilldown
  put max(81,min(557,the mouseh)) into x
  put max(167,min(287,the mousev)) into y
  set the loc of me to x,y
end mousestilldown

...has no penalty for releasing the mouse button anywhere outside the stack.
If a mouseUp handler exists in the same script, it gets executed no matter
where the mouse is, with the exception below. Otherwise the handler just
quits, nothing happens. If you were over a menu or another button, it
wouldn't have fired it until you clicked _again_.

_Unless_: If a mouseUp handler in the same object script had a conditional
statement tied to an area, and you released the button within that area,
then the rest of the handler would execute:

on mouseUp
  get the mouseLoc
  if it is within the rect of fld ID xxxx then
    doSomeStuff
  else
    doSomeAlternateStuff
  end if
end mouseUp

...otherwise, nothing would happen, no matter where you release the button.

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.

Best regards,
Ken N.









More information about the use-livecode mailing list