Drag file (blob) from 4D and drop into a system folder

Hi,

This seems an obvious question, but I don’t know if and how I can do this:
Is there a way to drag a blob in 4D (PDF document for example) and drop it into a folder on the system?
I know I probably should use pasteboards for this, but I don’t know how to implement this

Hello

What I would do:

  1. extract the pdf into a document in the temporary folder
  2. put the file in the container
If (Form event code=On Begin Drag Over)
	
	$path:=Temporary folder+"doc.pdf"
	BLOB TO DOCUMENT($path;$blob)
	SET FILE TO PASTEBOARD($path)
	
End if 

Hi,

Thanks, this seem to automagically work :grinning:
To clearify things :
I select a listbox row containing a filename
I create the document in the temporary folder and use SET FILE TO PASTEBOARD
Dragging the listbox row to the desktop creates the document on the desktop
However, dragging multiple rows by creating multiple docs doesn’t work, because when beginning the drag, the selection in the listbox is reduced to 1 row
Is there a solution for this?

Option/drag ?

And if you want to add file to pasteboard, don’t omit the *

Hi,

Option drag keeps the selection, that is good
When I have 3 lines (=docs) selected, I use SET FILE TO PASTEBOARD($temp_path) for the first document and SET FILE TO PASTEBOARD($temp_path;*) for the second and third
However, now I get a STOP icon when dragging over the desktop, and dragging is prohibited :thinking:
Do you have a clue why?

No experience with this case :unamused:
I must got to have time to experiment…

Hi,

I found the problem
When beginning to drag you have to use the option key to multi-select drag
But while dragging you have to release the key to allow dropping multiple documents

@vdl
For some reason I have difficulties with this dragging/dropping
Probably because I haven’t used it a lot until now :grinning:

At this point It is possible in my application to drag the documents from the listbox in the same listbox, because also dropping documents in the listbox is enabled
This is of course not what I want, because now the documents are getting duplicated
I know I can prevent dragging specific objects from specific sources
I thought I should use “On drag over”, but this event is not fired for some reason
How can I prevent dropping documents on the same source where I am dragging from?