Partager via


DragOver Event

Occurs when a control is being dragged over a target object.

PROCEDURE Object.DragOver
LPARAMETERS oSource, nXCoord, nYCoord, nState

Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter; otherwise an error occurs. Visual FoxPro passes the DragOver event parameters in the following order:

  • oSource
    Contains a reference to the control being dragged. You can refer to properties and methods of the control with this parameter.

  • nXCoord, nYCoord
    Contains the horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the Form when data is dragged over a drop target. These coordinates are expressed in terms of the Form's coordinate system in the unit of measurement specified by the ScaleMode property of the Form. '

  • nState
    Contains a number that represents the transition state of the control being dragged in relation to the target object:

    Setting

    Description

    0

    Enter. The control is being dragged within the range of a target.

    1

    Leave. The control is being dragged out of the range of a target.

    2

    Over. The control has moved from one position in the target to another.

  • Use nStateto determine actions at key transition points. For example, you can highlight a possible target on nState= 0 (Enter) and restore the object's appearance on nState= 1 (Leave).

When an object receives a DragOver event with nState = 0 (Enter):

  • A DragDrop event is triggered if the source control is dropped on a target object.

  • Another DragOver event is triggered with nState = 1 (Leave) if the source control is not dropped on a valid target.

Remarks

Applies To: CheckBox | ComboBox | CommandButton | CommandGroup | Control Object | EditBox | Form | Grid | Image | Label | Line | ListBox | OLE Bound Control | OLE Container Control | OptionButton | OptionGroup | Page | PageFrame | Shape | Spinner | TextBox | ToolBar

The object under the drag icon is the target object and responds to the DragOver event. You can use this event to monitor when the mouse pointer enters, leaves, or is directly over a target object.

Use a DragOver event to determine what happens after dragging is initiated and before a control is dropped onto a target. For example, you can verify a valid target range by highlighting the target, by setting the BackColor, or ForeColor property or by displaying a special pointer.

See Also

Reference

Drag Method

DragDrop Event

DragIcon Property

DragMode Property

MouseDown Event

MouseUp Event

MouseMove Event

Other Resources

Events (Visual FoxPro)

Language Reference (Visual FoxPro)