DragDropClient Class |
Namespace: VO
The DragDropClient type exposes the following members.
Name | Description | |
---|---|---|
DragDropClient |
Construct a drag-and-drop client.
Important! Normally, this method should not be called in your application code. Instead use Window:EnableDragDropClient(TRUE) to create a drag-and-drop client. |
Name | Description | |
---|---|---|
Dispatch | ||
DragLeave |
Notify the application that the mouse has left the client area of the window that owns the drag-and-drop client.
| |
DragOver |
Notify the application of a DragOver event and accept or reject the drop.
| |
Drop |
Retrieve information about a load from the drag event and act on each file in the selection.
|
1METHOD Init(oOwner) CLASS StandardShellWindow 2SUPER:Init(oOwner) 3SELF:Size := Dimension{300,100} 4SELF:Origin:= Point{0,20} 5SELF:Caption := "Non-MDI ChildWindow" 6SELF:EnableMinBox() 7SELF:EnableMaxBox() 8SELF:EnableSystemMenu 9SELF:EnableBorder() 10SELF:EnableDragDropClient() // Make the window a DragDropClient 11SELF:Show() 12METHOD DragOver(oDragEvent) CLASS StandardShellWindow 13LOCAL iCount AS INT 14LOCAL iAcceptDrop AS LOGIC 15// Check files that are being dragged over the window 16// Only accept if all files are .DBF 17lAcceptDrop := TRUE 18FOR iCount := 1 TO oDragEvent:FileCount 19IF RAT(".DBF", oDragEvent:FileName(iCount)) == 0 20lAcceptDrop := FALSE 21EXIT 22ENDIF 23NEXT 24RETURN lAcceptDrop 25METHOD DragLeave() CLASS StandardShellWindow 26// Undo any actions taken during drag-drop attempt 27METHOD Drop(oDragEvent) CLASS StandardShellWindow 28LOCAL nNumFiles := oDragEvent:FileCount 29// Number of entries dropped 30LOCAL nFile AS INT 31// For each item that is dropped, if it is a file, open it. 32FOR nFile := 1 TO nNumFiles 33IF File(oDragEvent:FileName(nFile)) 34SELF:DoOpenFile(oDragEvent:FileName(nFile)) 35ENDIF 36NEXT