DragItem.Destination
From Xojo Documentation
This property is only available on the macOS platform. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this property on an incompatible platform. |
The location of the dropped item when you drop it to the desktop or onto an application. The dragItem must contain some content that the Finder accepts.
Notes
Since Destination is of type Object, it potentially can return any type of Xojo object. Currently, Destination is set up to work only with the macOS Finder and will only return a FolderItem. To ensure that your application is compatible with future versions, check the type of object it returns with IsA before recasting it to a FolderItem.
On Windows and Linux, dragging items to the Desktop is not supported; therefore this property does not work on those platforms.
Sample Code
This code uses the Destination property to report the NativePath of a folder that is created by dragging a label from a window to the Finder:
Var f As FolderItem
Var d As Date
Var tos As TextoutputStream
d = New Date
f = SpecialFolder.Temporary.Child("test" + Format(d.TotalSeconds, "#"))
If f <> Nil Then
tos = TextOutputStream.Create(f)
tos.Write("Howdy! Created by DragToFinder example.")
tos.Close
di = New DragItem(Self, 0, 0, 100, 100)
di.FolderItem = f
di.Drag
If di.Destination <> Nil Then
If di.Destination IsA FolderItem Then
MessageBox(FolderItem(di.Destination).NativePath)
End If
End If
Else
MessageBox("Unable to get FolderItem for temporary file.")
End If