DesktopUIControl.AcceptPictureDrop

From Xojo Documentation

Revision as of 15:00, 17 February 2022 by Gperlman (talk | contribs) (Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. It will go offline as of October 2, 2023. Please visit the new Xojo documentation site! - you will be redirected shortly...
Method

DesktopUIControl.AcceptPictureDrop()

New in 2021r3

Supported for all project types and targets.

Permits pictures to be dropped on the control. Use this method to accept pictures dropped directly from another application such as a web browser. If you want to accept pictures that come from the file system (using Finder or Windows Explorer) you need to use AcceptFileDrop.

Notes

If a control should accept pictures in a drag and drop, then AcceptPictureDrop needs to be called prior to the drop. Typically, it is in the Opening event of the control itself. For example, the line:

Me.AcceptPictureDrop

in the Opening event of the control that will receive the dragged pictures is needed. When the picture is dropped, the DropObject event is called and this is where you will put your code to handle the drop.

Example

Opening Event:

Me.AcceptPictureDrop

DropObject Event:

If obj.PictureAvailable Then
Me.Backdrop = obj.Picture
End If