I think this is a general question however I’m specifically interested in a Mac OS implementation.
I use drag and drop extensively with controls in a running application but I cannot figure out how to implement drag and drop functionality onto an application icon.
Specifically, I would like too be able to drop a folder onto an un-launched application icon and have the app open and and process the files therein.
With a control (or window) I simply create a filetypes group and implement acceptFileDrop and put code in the control’s DropObject event handler. Evidently it’s different with app drag and drop?
Not the way you do regular drag and drop. In the file type, you will need to choose a “role” for your app. For a folder, that’s probably “view” or “alternate”.
Then in App.openDocument, you deal with the incoming folderitem.
Thanks @Greg_O_Lone.
This works when the application is running. What I would like, however, is for the app to launch and being processing the dropped item.
Drag a folder from the Finder and drop it on the FileTypeGroup
In the macOS section at the bottom, change Role to View and Rank to Default.
Right-Click on App and select Add to App > Event Handler.
Select OpenDocument and click OK
In the OpenDocument event, type the word “break”
From the IDE menu, select Project > Run Paused
The IDE will build the app and put it on disk with the debugger waiting to connect. Drag and Drop a folder onto the App icon and it should break into the debugger on the OpenDocument event with the folderitem pointing at the folder.