Drag-drop image onto app icon?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Drag-drop image onto app icon?

Post by thatkeith » Tue Jun 11, 2019 1:22 am

I have drag and drop working fine for dropping an image into an object in my stack. But is it possible to set things up so I can drag-drop an image onto my standalone icon in the Dock (I'm on a Mac) and have it work just the same?
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Drag-drop image onto app icon?

Post by Klaus » Tue Jun 11, 2019 12:28 pm

Hi Keith,

as far as I remember you need to catch -> on appleEvent
See the dictionary for further infoand an example.

And you may need to modify the pList to include one or more image formats in the list of formats that your app can handle. If not you need to press the ALT and CMD key when dragging an image on your dock icon to "force" the apple event.


Best

Klaus

matthiasr
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 190
Joined: Sat Apr 08, 2006 7:55 am
Location: Lübbecke, Germany
Contact:

Re: Drag-drop image onto app icon?

Post by matthiasr » Tue Jun 11, 2019 1:02 pm

This is an example script how it will work with the standalone under Mac OS.

Put the following script into the stack script and adjust it to your needs.

Code: Select all

on appleEvent pClass, pEventID, pSender
   
   if pClass is "aevt"  and pEventID = "odoc" then
       
       ## This is an apple event
       ## We request the data about the apple event
       request appleEvent data
      
      put it into tFileName
      ## now do whatever you want....
      ## in this example i am sending upload + the complete path of the dragged file to the card Main.
      send "uploadFile tFilename,tStartup" to card "Main" in 50 milliseconds
    
   end if
   
   pass appleEvent  
end appleEvent

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Drag-drop image onto app icon?

Post by thatkeith » Thu Feb 20, 2020 11:03 pm

Reviving an old(ish) thread:

THANKS for this! I'm sorry I didn't say this before.

One more question: any suggestions for how I should try to get this working for Windows users as well?
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9836
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Drag-drop image onto app icon?

Post by FourthWorld » Fri Feb 21, 2020 12:32 am

The Windows registry is the key - here's how to use it:

http://sonsothunder.com/devres/livecode ... ile004.htm
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Talking LiveCode”