Difference between revisions of "DesktopUIControl.AcceptPictureDrop"

From Xojo Documentation

(Example)
 
Line 22: Line 22:
  
 
==Example==
 
==Example==
Canvas.Opening:
+
Opening Event:
 
<rbcode>
 
<rbcode>
 
Me.AcceptPictureDrop
 
Me.AcceptPictureDrop
 
</rbcode>
 
</rbcode>
  
Canvas.DropObject:
+
DropObject Event:
 
<rbcode>
 
<rbcode>
 
   If obj.PictureAvailable Then
 
   If obj.PictureAvailable Then

Latest revision as of 15:00, 17 February 2022

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