how to capture 'movestack' end?

Scott Rossi scott at tactilemedia.com
Fri Jun 14 14:42:00 EDT 2002


Recently, Chipp Walters wrote:

> I need some help. I'd like to execute a command at the
> end of a movestack, but the movestack message is sent
> multiple times while the stack is being dragged
> around. For instance:
> 
> on moveStack
> beep
> end moveStack
> 
> will create a sequence of beeps for as long as you
> drag the stack around (PC, not Linux, not sure about
> Mac). If I insert a lock messages, I get a beep at the
> beginning of the movestack and nothing at the end. How
> can I 'trap' the end of the moveStack??

Another way to do this would be to place the following script in a button or
graphic in your stack.

on mouseDown
  set the uAllowDrag of me to the clickH & "," & the clickV
end mouseDown

on mouseMove x,y
  if the uAllowDrag of me is empty then exit mouseMove
  put globalLoc(x&","&y) into tLoc
  set topLeft of this stack to \
      item 1 of tLoc - item 1 of the uAllowDrag of me,\
      item 2 of tLoc - item 2 of the uAllowDrag of me
end mouseMove

on mouseUp
  set the uAllowDrag of me to empty
  # YOUR TRAP SCRIPT HERE
  answer "The drag is done."
  #
end mouseUp

on mouseRelease
  mouseUp
end mouseRelease

-----

Regards,

Scott Rossi
Creative Director

Tactile Media, Multimedia & Design
Email: scott at tactilemedia.com
Web: www.tactilemedia.com




More information about the use-livecode mailing list