Indicates the procedure to run during an event of Drag/Drop.
Remark: To determine the behavior of a control from the code when it is dragged and dropped, use the
DndTarget and
DndSource properties with the
dndProgram constant.
// Call the OnDrop procedure when the left mouse button
// is released on the target control named "EDT_Find"
DnDEvent("OnDrop", EDT_Find, dndDrop)
Syntax
DnDEvent(<Procedure> , <Control name> , <Type of event>)
<Procedure>: Character string
Name of the procedure that must be called during the <Type of event> event on the <Control name> control.
<Control name>: Character string
Name of the control on which the event must be processed.
<Type of event>: Constant
Type of event triggering the call to <Procedure>: | |
dndBeginDrag | Beginning of a Drag/Drop in a source control. |
dndDragEnter | Entry in a target control. |
dndDragLeave | Exit from a target control. |
dndDragOver | Hover a target control. |
dndDrop | Release the left mouse button on a target control. |
dndEndDrag | End of Drag/Drop. |
Remarks
The following variables can be used:
| |
Variable name | Description |
---|
_DND.Action | Action specified in DnDAccept. The possible values are: dndCopy, dndMove and dndNone. This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant). |
_DND.TargetControl | Name of the target control. This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant). |
_DND.SourceControl | Name of source control. |
_DND.CtrlDown | Status of Ctrl key:- True: the Ctrl key is pressed.
- False: the Ctrl key is not pressed.
This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant). |
_DND.SourceWin | Name of source window. This variable is not filled when exiting from a target control (dndDragLeave constant). |
_DND.MouseXPos | Horizontal position (X) of mouse cursor in relation to the control handled during the event. This variable is not filled when exiting from a target control (dndDragLeave constant). |
_DND.MouseYPos | Vertical position (Y) of mouse cursor in relation to the control handled during the event. This variable is not filled when exiting from a target control (dndDragLeave constant). |
The
_DND.SourceControl and
_DND.SourceWin variables return an empty string ("") when the Drag and Drop comes from an application other than the current application.