B4J Question Solved: [jDragAndDrop2] How to put files on the DragBoard

knutf

Active Member
Licensed User
Longtime User
How can I put files Using the jDragAndDrop2 library?
I can't figure out what parameters to use with the SetDragModeAndData sub to put a filepath\name on the DragBoard so that it can be detected by the HasFiles method of the DragBoard or by Windows Explorer.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Have you seen this example: https://www.b4x.com/android/forum/threads/jdraganddrop2-drag-and-drop.76168/#post-636391 ?

drag-gif.76167
 
Upvote 0

knutf

Active Member
Licensed User
Longtime User
This works:
B4X:
Sub txtSource_DragDetected(e As MouseEvent)
        Dim f As JavaObject 
        f.InitializeNewInstance("java.io.File",Array(File.Combine(File.DirTemp,"MyFile.txt")))
        Dim files As List
        files.Initialize
        files.Add(f)
        DragDrop.SetDragModeAndData(TransferMode.ANY, Array As String("application/x-java-file-list"),Array As Object(files))
        Log("DragDetected : Starting drag")
End Sub
 
Upvote 0
Top