Cross Application Drag Drop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Cross Application Drag Drop
So I have a couple of questions regarding drag and drop. Specifically, I'm building a datagrid form with lines of data. Simple, basically just a field. I want to be able to drag a line from that field and drop it in a Word document (and, eventually, Pages, WordPerfect, etc--but first, just Word).
Now, I can drag and drop the text okay. But what I want to do is process said text (rather, format it) in Word once it is dropped. I want to mark it with a Word field code, to be exact. Can you create a piece of text that contains a Word field code in Livecode, which then would be able to be dropped into Word? I'm not sure the Pasteboard on the mac or whatever Windows uses can carry that cross applications, it's probably a Word only feature. So that means doing it via Applescript or VBA--after the drop happens.
So how can I know what application received my drop? Sending Applescript meant for Word to Pages is definitely a no-no.
Also, a completely unrelated question: Is it trivial to have a longish list of data somewhere and only show a subset of it in a datagrid, depending on various search filters? Like, I want to allow people to only show one category of the data, or to be able to filter it by name, and even to transform the data to "short" form versus a long form, depending on where they are dropping it into Word.
Thanks!
Now, I can drag and drop the text okay. But what I want to do is process said text (rather, format it) in Word once it is dropped. I want to mark it with a Word field code, to be exact. Can you create a piece of text that contains a Word field code in Livecode, which then would be able to be dropped into Word? I'm not sure the Pasteboard on the mac or whatever Windows uses can carry that cross applications, it's probably a Word only feature. So that means doing it via Applescript or VBA--after the drop happens.
So how can I know what application received my drop? Sending Applescript meant for Word to Pages is definitely a no-no.
Also, a completely unrelated question: Is it trivial to have a longish list of data somewhere and only show a subset of it in a datagrid, depending on various search filters? Like, I want to allow people to only show one category of the data, or to be able to filter it by name, and even to transform the data to "short" form versus a long form, depending on where they are dropping it into Word.
Thanks!
Re: Cross Application Drag Drop
Hi Vance,
1. welcome to the forum!
2. Bad news, you cannot control data that is being dragged from Livecode and dropped outside
of the Livecode window/stack nor can you even know where the data will be dropped.
Best
Klaus
1. welcome to the forum!
2. Bad news, you cannot control data that is being dragged from Livecode and dropped outside
of the Livecode window/stack nor can you even know where the data will be dropped.
Best
Klaus
Re: Cross Application Drag Drop
Hmm. That is bad. However, I was wondering if it could still be done. Here's my thoughts: When you drag something, don't you get a dragEnd message when the drag completes? Even if it is outside the application boundaries? It won't have anything IN the dragDestination property, but won't the dragEnd message fire if it is dropped? Or does the dragEnd message fire regardless of a successful drop or not?
If the message fires at all, then I could probably do some fancy applescripting to talk to word and see if there's a new object that just got placed, and then control Word via applescript to find the new text (that I just dropped) and format it how I need to.
Does that sound reasonable at all?
If the message fires at all, then I could probably do some fancy applescripting to talk to word and see if there's a new object that just got placed, and then control Word via applescript to find the new text (that I just dropped) and format it how I need to.
Does that sound reasonable at all?
Re: Cross Application Drag Drop
Hi Vance,
I never needed to check if "dragend" is also sent outside of Livecode, so I have no idea.
but why don't you check this by yourself and tell us what you found out? Good luck
Best
Klaus
I never needed to check if "dragend" is also sent outside of Livecode, so I have no idea.
but why don't you check this by yourself and tell us what you found out? Good luck
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Cross Application Drag Drop
All.
''dragEnd" is sent to LC even if the drag is terminated outside the program. In fact, I dragged some text onto the desktop, where it simply vanished, and the message still was sent. So it is not even necessary that a valid container receive the contents of the drag.
Craig Newman
''dragEnd" is sent to LC even if the drag is terminated outside the program. In fact, I dragged some text onto the desktop, where it simply vanished, and the message still was sent. So it is not even necessary that a valid container receive the contents of the drag.
Craig Newman
Re: Cross Application Drag Drop
Sorry to bump this thread but I have a question.
Is it possible to drag information from a web browser into a livecode application?
Is it possible to drag information from a web browser into a livecode application?
Re: Cross Application Drag Drop
Hi Einherjar,
Check "the dragdata[...]" "on dragenter"!
Best
Klaus
yes!Einherjar wrote:Sorry to bump this thread but I have a question.
Is it possible to drag information from a web browser into a livecode application?
Check "the dragdata[...]" "on dragenter"!
Best
Klaus