Drag and drop guidance

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Aji
Posts: 15
Joined: Mon Sep 09, 2013 3:43 pm

Drag and drop guidance

Post by Aji » Thu Sep 12, 2013 6:40 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Drag and drop guidance

Post by Simon » Thu Sep 12, 2013 7:04 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 251
Joined: Fri Feb 24, 2006 9:45 am

Re: Drag and drop guidance

Post by elanorb » Thu Sep 12, 2013 10:48 am

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
Attachments
textDrag.zip
(3.05 KiB) Downloaded 176 times
Elanor Buchanan
Software Developer
LiveCode

Aji
Posts: 15
Joined: Mon Sep 09, 2013 3:43 pm

Re: Drag and drop guidance

Post by Aji » Fri Sep 13, 2013 8:19 pm

Thank you Elanor! I will investigate thoroughly this weekend.

Post Reply

Return to “Summer School 2013”