DesktopUIControl.AcceptFileDrop

From Xojo Documentation

Revision as of 18:11, 23 July 2021 by Gperlman (talk | contribs)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

DesktopUIControl.AcceptFileDrop(FileType as String)

New in 2021r3

Supported for all project types and targets.

Permits documents of type FileType to be dropped on the control. FileType must be a file type that you defined in via the FileType class or the File Type Sets Editor.

Sample Code

This code in the Opening event of an DesktopCanvas makes it possible for the user to drop either a picture or a file that is a jpeg image. The File Type Sets editor was used to define the “image/jpeg” file type. It is one of the “Common File Types” that is available in the editor.

Me.AcceptPictureDrop
Me.AcceptFileDrop("image/jpeg")

To restrict file drops to just folders (and not files), you can put this code in the DragEnter event:

If Not obj.FolderItem.IsFolder Then Return True