Hello
I am new to live code. I am try to develope apps based on drag and drop.
please see attached pic.
User have to drag and drop part of the body label to relevant box.
if drop on correct box then label centre location equal to correct box centre location
if drop on wrong box then set location of label back to start point.
Questions
1) how to track and store start location of label
2) how to set label location to box location if answer is correct
3) how to set label location back to start location
So far my code is as following where Code in RED not working and Code in Blue is working fine.
on touchStart
--get startlocation
end touchStart
-- dragORdrop is custom property set either drag or drop
on touchmove pid,pX,pY
if the dragORdrop of the target is "drag" then
set the loc of the target to pX, pY
end if
end touchmove
Many thanks in advance.
Drag and Drop HELP
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 153
- Joined: Thu Jun 29, 2006 4:16 pm
Re: Drag and Drop HELP
Hello nitya,
I've attached an example of one way to do this.
See the card script for the handlers.
take care
randy hengst
I've attached an example of one way to do this.
See the card script for the handlers.
take care
randy hengst
- Attachments
-
- Parts of the body.livecode.zip
- Parts of body example stack
- (99.29 KiB) Downloaded 325 times
Re: Drag and Drop HELP
Dear Randy
Your example rocks. I will try and run code on IPAD simulator.
Many thanks for help.
Regards
Nitya
Your example rocks. I will try and run code on IPAD simulator.
Many thanks for help.
Regards
Nitya
Re: Drag and Drop HELP
It would be nice to see this solution using the "touch" events, not the "grab" command.