Hi.
Within a rectangle graphic are several grabbable text-fields. The grabbing action has two constraints:
(1) text-fields cannot be dragged outside the rectangle
(2) text-fields cannot be dragged into each other
For (1), I'm using " set the constrainRectangular". No problem.
For (2), I'm using "intersectrect" within "constrainRectangularCallback" to check for collision. This too is no problem.
The problem is how to release the grabbed text-field when it has collided, i.e., when "intersectrect" returns not-false.
Hope that makes sense.
--
Nicolas Cueto
how to un-grab collided field-objects
Moderators: heatherlaine, kevinmiller, robinmiller, malte
Re: how to un-grab collided field-objects
Makes sense.
can you post your callback handler?
Cheers,
malte
can you post your callback handler?
Cheers,
malte
-
- VIP Livecode Opensource Backer
- Posts: 32
- Joined: Mon Jul 17, 2006 2:28 am
- Location: Motegi, Japan
Re: how to un-grab collided field-objects
Hi Malte,
Thanks.
--
Nicolas Cueto
Sure can:can you post your callback handler?
Code: Select all
on constrainRectangularExit
set the cpStartLoc of me to empty
end constrainRectangularExit
on constrainRectangularCallback
if the cpStartLoc of me is empty then \
set the cpStartLoc of me to the loc of me
put the loc of me into tGrabbedLoc
put the rect of me into tGrabbedRect
put the objects of this card into tObjects
filter tObjects with "*pasted object*"
filter tObjects without (the name of me)
repeat for each line tObject in tObjects
put word 2 of tObject into tObjectId
replace quote with "" in tObjectId
if intersectrect(tGrabbedRect,the rect of field tObjectID) <> "false" then
## R E L E A S E T H E G R A B !
set the loc of me to the cpStartLoc of me
exit repeat
end if
end repeat
end constrainRectangularCallback
--
Nicolas Cueto