BeforeDragOver

<< Click to Display Table of Contents >>

 

BeforeDragOver

BeforeDragOver(Index, Cancel, Data, X, Y, DragState, Effect, Shift)

This event occurs when there is a drag-and-drop action on an object. Use this event to monitor if the mouse pointer entered, left, or remained over a target object. This event is triggered when users move the mouse pointer or press and release any mouse button. Mouse pointer's position indicates the object generating this event. Users can determine the mouse pointer status by checking the DragState parameter.

Many objects do not support drag-and-drop operations while the Cancel parameter is set to False, which is its default behavior. This means that an object rejects any attempt of dragging or dropping some other object over it and, therefore, it does not trigger the BeforeDropOrPaste event. Text Box and Combo objects are exceptions. These objects accept drag-and-drop operations even when the Cancel parameter is set to False.

Available parameters on the BeforeDragOver event

Parameter

Description

Index

Indicates a page index, in a multi-page object, that is affected by the operation that generated this event. For other objects it is ignored

Cancel

Event status. Default is False and indicates that the target object handles this event and not the main application

Data

Data being dragged to the target object

X, Y

Position of the mouse pointer inside the target object, in points. X is measured from object's left side and Y is measured from object's top

DragState

Indicates the mouse pointer's condition when this event is generated:

0 - fmDragStateEnter: The mouse pointer is inside this object's range

1 - fmDragStateLeave: The mouse pointer is outside this object's range

2 - fmDragStateOver: The mouse pointer is at a new position, but still inside this object's range

Effect

Indicates all actions the target object supports, that is, the effect of dragging over that object:

0 - fmDropEffectNone: The target object does not accept copying or moving from any origin

1 - fmDropEffectCopy: The target object allows copying from any origin to it

2 - fmDropEffectMove: The target object allows moving from any origin to it

3 - fmDropEffectCopyOrMove: The target object allows copying or moving from any origin to it

Shift

An integer whose sum of factors indicates the status of SHIFT, CTRL, and ALT keys:

1: SHIFT key pressed

2: CTRL key pressed

4: ALT key pressed

For example, a value equal to 5 indicates that SHIFT and ALT keys were pressed (1 + 4 = 5)

Was this page useful?