Page 1 of 1

[Open] Drag and Drop from Finder

Posted: Fri Jan 13, 2006 9:11 pm
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

Re: [Open] Drag and Drop from Finder

Posted: Thu May 30, 2013 4:43 pm
by Wolfram
Hello,

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

Thanx

Re: [Open] Drag and Drop from Finder

Posted: Thu May 30, 2013 9:18 pm
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