views:

933

answers:

3

I have a ListView containing file names. These file names need to be draggable to a TreeView, which is a drag/drop inside the application and works with the built in drag/drop support of Delphi - no problem. But I must also be able to drag/drop the ListView items to another application, e.g. Windows Explorer. This also works, for example using a DragFileSource component of Anders Melander's Component Suite (http://melander.dk) which start it's work in the ListView.MouseDown event, so there is not really a drag/drop operation initiated.

Basically, I would need the same behaviour as you can see in a Windows Explorer: You can drag an item to another folder inside the application and also to another application.

How can this be done in Delphi? I guess there should be a "drag" initiated, but when the mouse moves outside the app window, it needs to "switch" to the other functionality, and should the mouse move back to the app window, again back to the standard drag drop.

Thanks for any help!

Holger

+1  A: 

If you want both VCL-style and Windows-style drag and drop, then use the Windows-style one for everything, including drag-and-drop within your own application.

Jim
+1  A: 

The DropMaster components may help with this - see http://www.raize.com/DevTools/DropMaster/

Nick Bradbury
+4  A: 

The Drag and Drop Component Suite you mentioned does this. You can initiate a drag which you can drop in your own app or other apps by default. Just pick the right clipboard format that other applications understand. What is your problem with it?

Lars Truijens
My problem is that I can only drop to another application using the DragFileSource component. It seemed to me that it is only doing this, and I have to do my own stuff for drag/drop inside the application.
Holgerwa
Lars, my problem is not to drag to another application with a DragFileSource component. I rather need it to be able to drop the source onto another component inside the app. It seems that as soon as DragFileSource has initiated it's dragging, I can only drop outside the app or cancel the drag.
Holgerwa
It just made a simple application and it works as expected. The problem must be in your code. You did use a TDropFileTarget for the other component inside your application?
Lars Truijens
Lars, thanks a lot for the hint. Of course, I did not use a TDropFileTarget, which was the problem.
Holgerwa