Page 1 of 1

DRAG AND DROP

Posted: Sat Mar 14, 2009 9:50 am
by smash
i have different scrolling list fields, and i would like to just drag and drop selected items from the scolling list fields into a large text box.

now i have "sort of" worked out how to drag an item within the scrolling list to move, but i end up with
"text being dragged" instead of the actual name of the item, with this code

on dragData
set the dragData["text"] to "text being moved"
end dragData

now their are far too many items to list in the "text being moved" and i have no idea what the code would be to fix that
never alone work out how to drag it out of the box all together.

do i need to but a code in the handler box that i wish the dragged item to end up in ??
cheers

Posted: Sat Mar 14, 2009 12:59 pm
by Klaus
Hi smash,

since the syntax of Rev is VERY english like, you should try to put the things you want to achieve into "plain" english. After you did this you can almost "translate" this 1:1 into Rev.
Check out my example "simple_memory1" stack at the bottom of my webpage:
http://www.major-k.de/xtalke.html
for more info about this.

Like this:
1. I want to select text in a list field
2. I want to drag this "selectedtext" (Hint, Hint! :)) to another field
3. I want to DROP this text on that other field.
4. I want to replace the text in the otherfield/append it to that field

At lest this is how I understand what you wnat to do.
Hint: "dragdata" is not a valid COMMAND in Rev!

Translation:

1. No scripting necessary, since a list field does this automatically just by clicking the mouse.
2. You START to drag "the selectedtext of fld XYZ"so you have to handle "dragstart", see the docs.

So put this into the script of your listfield:

Code: Select all

on dragStart 
  set the dragData["text"] to the selectedtext of me
end dragStart
3. and 4. check DRAGDROP in the docs.
Put this into the script of your target field (your "large text box")

Code: Select all

on dragdrop
  ## 3.
  ## put the dragData["text"] into me
  ## 4.
  ## put CR & the dragData["text"] after me
end dragdrop
Just comment out the line that fit your needs.

Hope that helps.


Best

Klaus

Posted: Sat Mar 14, 2009 1:34 pm
by smash
evening klaus
ok i put this into the handlers list for scrolling list field
on dragData
set the dragData["Text"] to the selectedtext of me
end dragData
and this into the text field i was wanting to drag it to

on dragdrop
put the dragData["text"] into me
end dragdrop
but nothing is happening
now what am i doing wrong ???
(i know it is hard to believe a female could be wrong) lol lol :wink:

Posted: Sat Mar 14, 2009 1:46 pm
by Klaus
Hi smash (what a martial name for a young lady :D)

I did NOT write:

Code: Select all

on dragDATA 
set the dragData["Text"] to the selectedtext of me 
end dragDATA
And I also gave an appropriate hint!
Please read my post again!

Best

Klaus

Posted: Sat Mar 14, 2009 2:11 pm
by smash
*slinks back in and pops my glasses on*
whoops
*runs off to rectify my embarrassing moment*

ok i put this into my scrolling list field
on dragStart
set the dragData["Text"] to the selectedtext of me into field "results"
end dragStart
and this into the big box
on dragdrop
put the dragData["text"] into me
end dragdrop
on dragEnter
set the acceptDrop to true
end dragEnter
and still nothing happens.

now i printed pages 259 - 262 out of the docs this morning, and have been most of the day to understand how this works.


Hi smash (what a martial name for a young lady )
i know it is not very ladylike name at all, i will try to rectify that one day :wink:

Posted: Sat Mar 14, 2009 2:18 pm
by Klaus
Hi smash

I still did not write this:

Code: Select all

on dragStart 
  set the dragData["Text"] to the selectedtext of me INTO FIELD "RESULTS" 
end dragStart
Please polish your glasses :D


Best

Klaus

Posted: Sat Mar 14, 2009 2:26 pm
by smash
*runs up and gives you a peck on the cheek"
i know, i know
BUT
i had put this in also
on dragStart
set the dragData["text"] to the selectedtext of me
end dragStart
and that did not work either so i tried to "improvise" lol
obviously not very well by the tone of your voice LOL
i am trying klaus, (and no not your patience)
:oops:

Posted: Sat Mar 14, 2009 2:44 pm
by Klaus
Hi smash

hmm, tested here with an example stack and it works...?

I can send you this tiny stack, if you like, just send me you mailaddress to:
klaus@major-k.de


Best

Klaus

Posted: Sat Mar 14, 2009 4:00 pm
by gyroscope
Hi Klaus

Hope smash doesn't mind me asking you some questions via her thread; thank you in advance, smash!

• Is there some coding to actually see the line of type between dragged between the list box and the field, please?

• Could you give some indication of what else is needed in the on dragDrop script of a second scrolling List field; i.e so that a listField would accept a dragged line from another ListField please?

Posted: Sat Mar 14, 2009 4:14 pm
by Klaus
Hi all,

to actualy SEE what you are dragging you need to take a snapshot of the "area to be dragged" and then set "the dragimage" to that image.

You will find an example for this (and a LOT more extremely beautiful and stunning example stacks of Scott Rossi at: http://www.tactilemedia.com/!
You will have to click "Software" then "Revolution..." and then scroll down for "Get In Line"...

And you should also check the fantastic tutorials of Eric Chatonet (RIP!) at his website: http://www.sosmartsoftware.com/?r=revolution&l=en.

I am sure you will find there what you are looking for :)


Best

Klaus

Posted: Sat Mar 14, 2009 5:09 pm
by gyroscope
Thank you for your quick reply, Klaus. I'll check those sites out now.

:)

Posted: Sat Mar 14, 2009 10:15 pm
by Mark
Dear Smash,

Have you noticed that people usually don't use ALL CAPS to write titles for their posts on this forum?

Best regards,

Mark

Posted: Sat Mar 14, 2009 10:16 pm
by smash
MORNING KLAUS
i have tried to email you, but for some reason it wont send
so here is my email address
performancepintos@gmail.com

i would love to work out how this works,
THANK YOU KLAUS

Posted: Sat Mar 14, 2009 10:21 pm
by smash
oh sorry mark,
no i did not, but do now.