DragAndDrop Event
Object List Next Object
Defined By: ButtonGadget
Description:
Raised on drag-and-drop targets during a drag operation.
Usage:
Sub DragAndDrop(source As XferData, x As Single, y As Single, state As
OleDropState, effect As OleDropEffect)
Details:
If you want a particular gadget to be a drop target, then that gadget should
supply code for this event. This is the only event raised during file drag
operations and is the only event that notifies you if an object is entering,
leaving, or over a drop target.
The state argument is an OleDragState enumeration that has the following meanings:
Constant/Value Description
0 - Enter The mouse has entered the window
- - Leave The mouse has left the window
- - Over The mouse is moving over the window
- - Drop The mouse button was released over the window, meaning a drop is being
attempted.
- - DropFile A file from the file manager has been dropped.
The effect argument is used to indicate which type of drag operation is being attempted,
supply visual feedback through the cursor, and notify the drop source of the
result of the drop.
The effect argument is an OleDragEffect enumeration, that has the following meanings:
Constant/Value Use to...
DragAndDropConstants.DND_NONE="0x0" Refuse the drop and show the no-drop cursor.
0 - None, or LastFile Refuse the drop and show the no-drop cursor, or indicate that no more events
are coming when files are dragged from the File Manager. This is the last file
drop event and can be used to refuse further file drop events (for a single
drop).
- - Copy Indicate that a copy is being offered or accepted, or the drop resulted in a
copy.
- - Move Indicate a move is being offered or accepted, or the drop resulted in a move.
4 - Link Indicate a link is being offered or accepted, or the drop resulted in a link.
-1 - MoreFiles Indicate that more events are coming when multiple files are dragged from the
File Manager.
- - Copy+Move Copy and Move are both offered.
5 - Link+Copy Link and Copy are both offered.
6 - Link+Move Link and Move are both offered.
7 - Link+Copy+Move Link, Copy, and Move are all offered.
If the state argument is < "DropFile," then effect is the drop effect, meaning that the value passed to Xfer.Drag(effect) as
altered by modifier keys. Code can inspect the operation offered and can disallow
operations by changing effect's value. This determines what the drop feedback
will be and tells the drop source the result of the drop (via the value returned
by XferData.Drag(effect)).
If the state argument is == "DropFile," a drop event will be raised for each
file dropped. The first event will have effect = number of remaining files, each
subsequent event will have effect = "MoreFiles" until the last event where
effect = "None." To stop at some number of files (such as 1), you can set effect =
None, otherwise it should not be set.
See Also:
DragStart event, MouseDown, MouseUp, MouseMove events.