Compartilhar via


OLEDragDrop Event

Occurs when data is dropped on a drop target and the drop target's OLEDropMode property is set to 1 – Enabled.

PROCEDURE Object.OLEDragDrop
LPARAMETERS oDataObject, nEffect, nButton,
 nShift,   nXCoord, nYCoord

Property Values

  • oDataObject
    An object reference to OLE drag-and-drop DataObject, used with the GetData and GetFormat methods to return data and data formats in the DataObject.

  • nEffect
    A value passed to the OLECompleteDrag event, indicating the action performed when data is dropped on the drop target. nEffect is initially a value that indicates the OLE drag-and-drop operations supported by the drag source. Within the OLEDragDrop event you can change the value of nEffect , which is passed to the OLECompleteDrag event. If you change the value of nEffect, be sure to include NODEFAULT in the event code to prevent the default behavior. The following table lists the values for nEffect that you can pass to the OLECompleteDrag event with a description of each action.

    nEffect Foxpro.h constant Description
    0 DROPEFFECT_NONE Drop target did not accept the data or the drop operation was canceled.
    1 DROPEFFECT_COPY Data was copied from the drag source to the drop target.
    2 DROPEFFECT_MOVE Data was moved from the drag source to the drop target.
    4 DROPEFFECT_LINK Data was linked from the drag source to the drop target.
  • nButton
    Contains a number that specifies which mouse button was released to drop the data on the target: 1 (left), 2 (right), or 4 (middle).

  • nShift
    Contains a number specifying the state of modifier keys when the mouse was released to drop the data on the drop target. The valid modifier keys are the SHIFT, CTRL, and ALT keys. The values returned in nShift for individual modifier keys are listed in the following table.

    nShift Modifier key
    1 SHIFT
    2 CTRL
    4 ALT

    If more than one modifier key is held down when the mouse is pressed, the nShift argument contains the sum of the values for the modifier keys. For example, if the user holds CTRL while releasing the mouse button, the nShift argument contains 2. But If the user holds CTRL+ALT while releasing the mouse button, the nShift argument contains 6.

  • nXCoord, nYCoord
    Contains the horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the Form when the mouse button was released to drop the data on the 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.

Remarks

OLEDragDrop is a drop target event that only occurs when the OLEDropMode property for the control or object is set to 1 – Enabled. This event does not occur if the OLEDropMode property is set to 0 – Disabled or 2 – Pass to Container.

If you perform your own drop processing in the OleDragDrop event, include NODEFAULT to prevent the default drop from occuring. In this case, you must then set the resulting nEffect value.

See Also

OLE Drag-and-drop Overview | OLECompleteDrag Event | OLEDropMode Property

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