[Open] Drag and Drop from Finder

Mac OSX specific forum
garretthylltun
Enthusiast
Enthusiast
Posts: 346
Joined: Wed Oct 26, 2005 2:46 am
Contact:

[Open] Drag and Drop from Finder

Post by garretthylltun »

Has anyone succeeded in getting drag and drop functionality from Finder
to a PB app?

If yes, would you be willing to share your knowledge with us and share
some code?

Thanks,
-Garrett
Wolfram
Enthusiast
Enthusiast
Posts: 606
Joined: Thu May 30, 2013 4:39 pm

Re: [Open] Drag and Drop from Finder

Post by Wolfram »

Hello,

do you get a solution for drag and drop from OSX Finder?

Thanx
macOS Catalina 10.15.7
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [Open] Drag and Drop from Finder

Post by Shardik »

garretthylltun wrote:Has anyone succeeded in getting drag and drop functionality from Finder
to a PB app?
Wolfram wrote:Hello,

do you get a solution for drag and drop from OSX Finder?
This is actually very simple in PB 5.11 (tested on Snow Leopard 10.6.8 and Mountain Lion 10.8.3 with default subsystem Cocoa x86 + x64 and subsystem Carbon x86; in Carbon even a plus icon is attached to the cursor when above the EditorGadget). Just select one or multiple files in the finder, drag them to the PB window and drop them onto the EditorGadget: the dropped filename(s) will be displayed in the EditorGadget.

Code: Select all

OpenWindow(0, 50, 50, 300, 260, "Drop files from Finder")
StickyWindow(0, #True)
EditorGadget(0, 10, 10, 280, 240)
EnableGadgetDrop(0, #PB_Drop_Files, #PB_Drag_Copy)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_GadgetDrop
      SetGadgetText(0, EventDropFiles())
  EndSelect
ForEver
Post Reply