Click or drag to resize

DragDropClient Class

X#
Create the client for use in a drag-and-drop operation.
Inheritance Hierarchy
Object
  VObject
    DragDropClient

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.21
Syntax
 CLASS DragDropClient INHERIT VObject
Request Example View Source

The DragDropClient type exposes the following members.

Constructors
  NameDescription
Public methodDragDropClient
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.
Top
Methods
  NameDescription
Public methodDispatch
Public methodDragLeave
Notify the application that the mouse has left the client area of the window that owns the drag-and-drop client.
Public methodDragOver
Notify the application of a DragOver event and accept or reject the drop.
Public methodDrop
Retrieve information about a load from the drag event and act on each file in the selection.
Top
Fields
  NameDescription
Public fieldoCargo
Cargo slot.
(Inherited from VObject.)
Top
Remarks
In Windows, "drag-and-drop" is a technique by which users can move files from one location to another, either visually (using the mouse) or through another system-accepted method. The client in a drag-and-drop operation is a utility object with an associated owner window that accepts dropped files. Creating a drag-and-drop client automatically makes its owner window capable of accepting drag-and-drop loads. The event handlers in the drag-and-drop client handle the events relevant to the drag-and-drop operation.
Important! When you call Window:EnableDragDropClient(TRUE), the window becomes a DragDropClient and inherits all the methods of DragDropClient. The callback methods DragLeave(), DragOver(), and Drop() are called on the Window object when a DragLeave, DragOver, or Drop event occurs (see the example below.)
Examples
The following example demonstrates the use of the DragDropClient class:
X#
 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
See Also

Reference