Drag group
Ryno Swart
swartart at iafrica.com
Tue Jan 14 08:32:01 EST 2003
Thanks for the help, Scott and Monte,
I'm getting there. However, the mouseMoves you kindly suggested work
well with an object such as a button, while not seeing or treating a
group as an object.
As I have exactly the effect I want, the simplest for me is to show you
where I am now (having turned Scott's drag_sample stack around a bit).
I created a long flat graphic. In it I placed 7 buttons, named Drag me
and 2, 3, 4, 5, 6, and 7. These make up the group I would like to drag.
I made the group wider than the graphic.
So far, the script for this group is
on mouseDown
set the uAllowDrag of me to \
the mouseH - left of me & "," &\
the mouseV - top of me
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(left of grc Viewfinder+W, max(x,right of grc Viewfinder-W)),\
min(bottom of grc Viewfinder-H,max(y,top of grc Viewfinder+H))
end mouseMove
on mouseUp
set the uAllowDrag of me to empty
end mouseUp
and it all works exactly as I want, except that while I can click on
any button, the moment I move the mouse, it is always over no 4. If, as
I hope to do I have about 20 images in his group, I fear that I will
not be able to drag all the way to the images furthest from the centre
one. This is why I need to make the mouse grasp the button that it goes
down onto, and drag the group from this position. I know that there may
be other solutions, such as working with a scroll bar, but this is just
so beautiful!
Can it be made perfect as well?
Much inspiration,
Ryno.
More information about the use-livecode
mailing list