Drag-drop image onto app icon?

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Drag-drop image onto app icon?

Post by thatkeith »

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: 14326
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Drag-drop image onto app icon?

Post by Klaus »

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: 195
Joined: Sat Apr 08, 2006 7:55 am
Contact:

Re: Drag-drop image onto app icon?

Post by matthiasr »

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: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Re: Drag-drop image onto app icon?

Post by thatkeith »

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: 10105
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Drag-drop image onto app icon?

Post by FourthWorld »

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