Drag a group
Moderators: heatherlaine, kevinmiller, robinmiller, malte
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Location: College Station, Texas
- Contact:
Drag a group
I want the user to be able to drag & drop a group (set of objects that have been grouped). Can this be done in Revolution itself, if not, can Arcade Engine provide this function? Is there an example somewhere?
Thanks.
Thanks.
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Location: College Station, Texas
- Contact:
One solution tried
I tried this:
on mouseDown
grab group "CHTop" (also tried 'Grab me')
end mouseDown
At least the objects in the group all move, but they do not keep their relative positions, the group configuration changes drastically as it is dragged around.
on mouseDown
grab group "CHTop" (also tried 'Grab me')
end mouseDown
At least the objects in the group all move, but they do not keep their relative positions, the group configuration changes drastically as it is dragged around.
Ron, maybe try something like this in the group script-
on mouseDown pMouseBtnNum
if pMouseBtnNum is 1 then set the cDragging of me to true
set the hOffset of me to the mouseh - item 1 of the location of me
set the vOffset of me to the mousev - item 2 of the location of me
end mouseDown
on mouseMove pMouseH,pMouseV
if the cDragging of me then set the location of me to pMouseH - the hOffset of me, \
pMouseV - the vOffset of me
end mouseMove
on mouseUp pMouseBtnNum
if pMouseBtnNum is 1 then set the cDragging of me to false
end mouseUp
on mouseDown pMouseBtnNum
if pMouseBtnNum is 1 then set the cDragging of me to true
set the hOffset of me to the mouseh - item 1 of the location of me
set the vOffset of me to the mousev - item 2 of the location of me
end mouseDown
on mouseMove pMouseH,pMouseV
if the cDragging of me then set the location of me to pMouseH - the hOffset of me, \
pMouseV - the vOffset of me
end mouseMove
on mouseUp pMouseBtnNum
if pMouseBtnNum is 1 then set the cDragging of me to false
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Wed Oct 13, 2010 4:44 am
Re: Drag a group
is there a way to do this? i've just been trying with ae constrainRectangular, and can only get it working with single objects (button, img). as soon as I try the logic on a group... no movement on the drag action.
Any ideas? Need user to be able to drag a button (with downstate) + an accompanying text field.
Any ideas? Need user to be able to drag a button (with downstate) + an accompanying text field.
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Wed Oct 13, 2010 4:44 am
Re: Drag a group
Well,
This may have unknown drawbacks, but a simple win exists in the following:
this allows the extra txt field to 'follow' the dragged item around. any gotchyas?
This may have unknown drawbacks, but a simple win exists in the following:
Code: Select all
on constrainRectangularCallback
set the loc of fld "texty" to the loc of me
end constrainRectangularCallback
this allows the extra txt field to 'follow' the dragged item around. any gotchyas?
Re: Drag a group
Have you tried setting the opaque property of the group to true?