Page 1 of 1
Drag then lock?
Posted: Sat Jun 20, 2009 10:01 pm
by TodayIsTheDay
I've been playing around with the "on mousedown grab me" command so I can drag a box, button or whatever at runtime.
Is there a way to have an image of a lock (or whatever) that once I'm done dragging things all over the screen I can lock everything into place?
Thanks
Patrick
Drag then lock?
Posted: Mon Jul 13, 2009 5:39 am
by edljr
Patrick,
Here is one way to accomplish what you want:
1) Create a global variable to indicate the lock/unlock state.
2) Put something like this into the objects you want to move:
Code: Select all
on mouseDown
global moveable
if moveable then grab me
end mouseDown
3) Add a lock graphic with the following script:
Code: Select all
on mouseUp
global moveable
put false into moveable
set the vis of img "unlock" to false
set the vis of img "lock" to true
end mouseUp
HTH,
Ed
Re: Drag then lock?
Posted: Tue Dec 24, 2019 3:04 pm
by dunbarx
Hi.
Since the grab command allows a "mouseUp" message to pass to the control of interest once you "release" the grab sequence, simply set the locLoc of the control to true.
Craig
Re: Drag then lock?
Posted: Tue Dec 24, 2019 3:48 pm
by dunbarx
It just occurred to me. Did you mean that once the control has been moved, it cannot be moved again by any means? Including another grab command?
If so, then Ed's offering above is a good one, disabling the grab command entirely based on some flag or property.
Craig
Re: Drag then lock?
Posted: Fri Dec 27, 2019 12:30 pm
by richmond62
Well, I suppose it was worth a try.
-
-
HOWEVER . . .
By having
this in the graphic object script:
Code: Select all
on mouseDown
grab me
end mouseDown
and
this in the cardScript:
Code: Select all
on mouseUp
set the script of grc "OCT" to fld "newCODE"
end mouseUp
where fld "newCODE" contains
this:
Code: Select all
on mouseDown
---do nix
end mouseDown
on mouseUp
---do nix
end mouseUp
everything is just dandy, and very simple indeed.
