Page 1 of 1

Drag and drop guidance

Posted: Thu Sep 12, 2013 6:40 am
by Aji
I have a large text field with a paragraph of text. I also have a few text snippets in their own fields (or buttons). I'd like to be able to allow my app's user to drag one of the text snippets and drop it into the large text field. It's kinda like the "magnetic poetry" game. It's also kinda like this "insert at caret" demo:
h t t p : //skfox . com/jqExamples/insertAtCaret . html (sorry, I don't have permission to paste an url directly in this forum)

If this is possible, how should I go about doing this in LiveCode?

Thank you,
..Jill

Re: Drag and drop guidance

Posted: Thu Sep 12, 2013 7:04 am
by Simon
Hi Jill,
Welcome to the forum! :)

Have you looked at this lesson?
http://lessons.runrev.com/s/lessons/m/4 ... t-a-primer

Not sure it covers multi-line text. If you have exhausted that lesson then ask again. :)

Simon

Re: Drag and drop guidance

Posted: Thu Sep 12, 2013 10:48 am
by elanorb
Hi Jill

A lot of this will be handled automatically for you by LiveCode. Attached is a sample stack, with no code. If you highlight some text in the list of fruits and drag it into the main text field it will be automatically pasted in where you drop it, without you having to do anything.

If you have any other particular requirements please let me know. As a general pointer have a look at the clipboardData property and the clipboard function. Also the copy and paste commands could be useful.

Kind regards

Elanor

Re: Drag and drop guidance

Posted: Fri Sep 13, 2013 8:19 pm
by Aji
Thank you Elanor! I will investigate thoroughly this weekend.