Dear Livecoders,
I'm building an app that makes use of Livecode's drag & drop facilities. So far, I've successfully built an app that can happily receive stuff dragged onto it from external apps/OS, determine what sort of thing is being dropped and respond accordingly.
However, I can't figure out how to create the reverse of it - i.e. dragging stuff from Livecode to the external environment for processing by the OS or another app. I can successfully get my app to copy various types of control and populate the relevant clipboard data keys and this works fine for the OS and most external apps but I can't figure out how to parallel this copy/paste with drag & drop.
If I drag a control/object from Livecode to somewhere outside the application I don't get the mouse pointer changing to indicate something is being dragged as you might do when dragging from another application even if i set the allowabledragactions on the control appropriately.
Any ideas?
Stan
dragging FROM LiveCode to external apps
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: dragging FROM LiveCode to external apps
Hi stan,
Best
Klaus
you may need to parse the keys of the DRAGDATA array, see dictionary, and act accordingly.stan wrote: ↑Fri Aug 30, 2024 11:54 am...
However, I can't figure out how to create the reverse of it - i.e. dragging stuff from Livecode to the external environment for processing by the OS or another app. I can successfully get my app to copy various types of control and populate the relevant clipboard data keys and this works fine for the OS and most external apps but I can't figure out how to parallel this copy/paste with drag & drop.
Nut sure, but I'm afraid LC controls are a format tha external apps cannot understand, maybe that is the problem?stan wrote: ↑Fri Aug 30, 2024 11:54 am...
If I drag a control/object from Livecode to somewhere outside the application I don't get the mouse pointer changing to indicate something is being dragged as you might do when dragging from another application even if i set the allowabledragactions on the control appropriately.
Best
Klaus
Re: dragging FROM LiveCode to external apps
A lot depends if the receiving app acceps drag, drag Drop.
Try this experiment. Im on Windows.
Create a field, add some text.
Add this code to the field
Open Notepad (Windows?)
Select some text from the field, drag and drop into Notepad..
Works here.
Try this experiment. Im on Windows.
Create a field, add some text.
Add this code to the field
Code: Select all
on dragStart
set the dragData to the selectedText of me
end dragStart
Select some text from the field, drag and drop into Notepad..
Works here.
Andy .... LC CLASSIC ROCKS!
Re: dragging FROM LiveCode to external apps
On a Mac, Drag'n'Drop of text works without any scripting right out of the box.
I tried from a LC field to "TextEdit.app".
I tried from a LC field to "TextEdit.app".
Re: dragging FROM LiveCode to external apps
yep, just tried on Windows and it works.On a Mac, Drag'n'Drop of text works without any scripting right out of the box.
I tried from a LC field to "TextEdit.app".
Andy .... LC CLASSIC ROCKS!
Re: dragging FROM LiveCode to external apps
Thanks for such fast responses!
...and problem solved - setting the dragdata appropriately works - and you can use dragdata["file"] and drag data["image"] to drag files & images as well as text.
Stan
...and problem solved - setting the dragdata appropriately works - and you can use dragdata["file"] and drag data["image"] to drag files & images as well as text.
Stan