Drag file to another application lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- havezet · 2011-11-29 08:35 In my application I've got a thumbnail image that represents a file. I now want to drag this thumbnail and drop it to another location in the OS (e.g. an application on the Dock, or to the desktop). Is there a way to do this in Lazarus? Any pointers are welcome. ---------------------------------------------------------------------- havezet · 2011-12-18 08:49 No replies? Doesn't seem like a very exotic question... ---------------------------------------------------------------------- mica · 2011-12-18 18:22 http://wiki.lazarus.freepascal.org/LCL_Drag_Drop ---------------------------------------------------------------------- felipemdc · 2011-12-18 21:34 Strange, there it is written that drag-and-drop between applications works only between LCL applications. I never knew that, and I don't know if it is really like that. My major applications do not need this feature, so I never studied it, although it looks interresting. So basically if that is true to do drag&drop to/from non-LCL applications you would need to either extend the LCL to support it (implementing in each widgetset that you need via operating system calls) or use operating system APIs directly to do it. ---------------------------------------------------------------------- Shebuka · 2012-01-13 15:45 have you read this? http://www.lazarus.freepascal.org/index.php/topic, 15308.msg82180.html#msg82180 ---------------------------------------------------------------------- prof7bit · 2012-08-25 22:23 Quote from: havezet on November 29, 2011, 09:35:33 amIn my application I've got a thumbnail image that represents a file. I now want to drag this thumbnail and drop it to another location in the OS (e.g. an application on the Dock, or to the desktop). Is there a way to do this in Lazarus? Any pointers are welcome. I made a component, its still very new (not thoroughly debugged yet) but it already allows dragging of files and/or text/plain content to other applications. It currently works (or is supposed to work) on Win32, Gtk2 and Qt. you can find it here: https://github.com/prof7bit/NativeDragDrop. If you still need it then give it a try, it has the same license as LCL itself. Edit: I just notticed that this is the OS X subdivision of the forum. (This Thread came up as #1 after a google search for the topic and I did not notice that it was an OS X question). My component is intended to work on as many widgetsets as possible, I have implemented win32, Gtk and Qt myself but I cannot implement it for Carbon or Cocoa because I simply do not own a Mac, here I need some help from a native Mac programmer, maybe somebody here can contribute some code for the Mac. ---------------------------------------------------------------------- staratel20 · 2025-09-22 11:41 I tried to install your component(Windows 11, Lazarus IDE v3.6) but when I clicked the "Compile" button, I got the following error message: dragdropwin32.pas(102,17) Error: No matching implementation for interface method "SetData(const tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt; StdCall;" found ---------------------------------------------------------------------- staratel20 · 2025-09-22 19:27 Here is a couple of fixes and a test example, now it works. Hope you'll commit it