Drag group.

Ryno Swart swartart at iafrica.com
Sat Jan 11 13:04:01 EST 2003


Thanks to all you people who have helped me with my storyboard stack, 
which has now been lying fallow for a while, waiting for an insight.

Scott, or whoever else would like to help here, I recently downloaded 
your very elegant Drag Sample stack from which I appear to be able to 
get exactly the results I want, but of course I ran into a few problems.

I adapted it as follows:

Made a group called "Drag us then" with two buttons: "Drag me" and "and 
me".
Set the height and the width of graphic "New Graphic 1" to allow only 
horizontal movement, and created a new little graphic, "Oval".

The script for group "Drag us then" (9 lines!) is:
--
on mouseDown
   set the uAllowDrag of me to true
end mouseDown

on mouseMove x,y
   if not the uAllowDrag of me then exit mouseMove
   put width of me/2 into W
   put height of me/2 into H
     set the loc of me to \
       min(right of grc 1-W,max(x,left of grc 1+W)),\
       min(bottom of grc 1-H,max(y,top of grc 1+H))
end mouseMove

on mouseUp
   set the uAllowDrag of me to empty
end mouseUp

on mouseRelease
   mouseUp
end mouseRelease
--

This works beautifully. But.

Problem 1: The mouse drags the group in mouseOver mode instead of only 
in mouseDown.

I would like to have my buttons do, for now, something like beep, or 
show graphic "Oval".

Problem 2: When I move the mouse over the group, the group moves so 
that it is centered under the mouse, and I cannot click on either 
button, unless I move it to where it is constrained on the left or the 
right and then push the button over.

Can I get the buttons to hold still for me to move the mouse around the 
buttons, allowing mouseOver messages, and then to click on the one of 
my choice?

Please be patient the entry level of these questions. I am sure there 
are many other beginners who would enjoy access to your experience.

Ryno Swart.

P.S. At the moment I cannot get into the "media" part of you very 
elegantly redesigned site.




More information about the use-livecode mailing list