drag drop, location, not sure about syntax

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Just4Fun
Posts: 12
Joined: Tue Nov 25, 2008 1:14 am

drag drop, location, not sure about syntax

Post by Just4Fun » Fri Jan 29, 2010 11:06 pm

Hello Again:

I've been spending another frustration filled day with Rev. I'm trying to fight through the fact that this program has no decent documentation for beginners. At the moment, I'm pretty sorry that I ever purchased the software. It cost a lot of money on my budget. I assumed that it would have excellent documentation. What I've found is that the documentation is scattered around in so many places, that I spend hours searching. The dictionary is fine for someone who already somewhat understands the syntax, but there are no code snips included therein so it doesn't help me much. :(

At any rate, my problem today is that I am trying to figure out how to apply a drag and drop feature in a small "Match" quiz. Here is what I'd like to be able to do:

Drag my image onto another image. If they match then the dragged image is allowed to drop. If they don't match, the image snaps back to its original location.

I've searched the forum and found a couple of examples that I couldn't apply successfully. They used the location command. I couldn't get them to work properly for my need. I tried using the resources code example of dropping the colors from a pallet onto an object. That didn't work. I've tried searching the GMANE list for help. Found nothing.

If anyone could post some simple code snips that would put me in the right direction, I'd really appreciate it.

grab
loc
drag
drop

TIA
Rachel

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: drag drop, location, not sure about syntax

Post by bn » Fri Jan 29, 2010 11:58 pm

Rachel,
I did a simple stack a while ago which is a starting point for a puzzle.
I append it here.
Re frustration: I remember having these times even with better documented environments then Rev, it's part of the game. The more you will enjoy when it finaly works... :)
regards
Bernd
Attachments
puzzlePiece2.rev.zip
(4.92 KiB) Downloaded 249 times

Just4Fun
Posts: 12
Joined: Tue Nov 25, 2008 1:14 am

Re: drag drop, location, not sure about syntax

Post by Just4Fun » Sat Jan 30, 2010 2:00 am

Bless you Bernard. I will dig into the sample stack right away.

-Rachel

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: drag drop, location, not sure about syntax

Post by bn » Sat Jan 30, 2010 3:02 pm

Rachel,
I modified the stack a little so it behaves more like I think you will want it. The original request was for "automatic" pic-up of the puzzle piece.
In this version you have to click at a puzzle piece then it follows the mouse until it either hits the right destination image or if it hits a wrong destination image it slides back to the original position.
Dont be confused with the private properties that are set. A private property is a way to store information in any Rev object.
Try this. It might be easier. Now it brings the puzzle piece that is moved around so it is not covered by any other image.
You still have to initialize the puzzle once you arranged the location of the puzzle pieces and their destination. It all expects a certain naming convention, the pieces to move around must have the name "puzzlepiec" with an unique number at the end as in "puzzlepiece1" and a corresponding image with the name "finalposition1".
I hope this gets you further. The first version was just too sketchy.
regards
Bernd
Attachments
puzzlePiece3.rev.zip
(5.24 KiB) Downloaded 248 times

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: drag drop, location, not sure about syntax

Post by mwieder » Sun Jan 31, 2010 6:39 pm

Also, I posted a primer on drag and drop a while back. You might want to check it out:

http://lessons.runrev.com/spaces/lesson ... t-a-primer

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: drag drop, location, not sure about syntax

Post by bn » Sun Jan 31, 2010 9:58 pm

Hi Rachel,
I start to worry about you ... :) Still frustration?
The only thing I can offer is yet another version of the puzzle starter kit.
Now with 20% more fancyness...
And with a 50% reduction in price, before it was free, now it is a spectacular 50% more free. (Though you will not ever get a bonus for downloading it :( , that is not our buisiness model)

regards
Bernd
Attachments
puzzlePiece4.rev.zip
(5.8 KiB) Downloaded 243 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: drag drop, location, not sure about syntax

Post by bn » Fri Feb 05, 2010 4:25 pm

I posted colorpuzzle to RevOnline that arose from this thread.
I posted it also as a revlet
http://berndniggemann.on-rev.com/colorpuzzle/
Rachel, if you are still following this thread: I commented the scripts of the stack extensively. If you have questions, just ask.
regards
Bernd

Post Reply