Event XbpCrt():dragDrop Foundation

Item has been dropped over a drop zone.

:dragDrop := {| aState, oDragData, self | ... } --> nAction
:dragDrop( aState, oDragData ) --> nAction
xbeP_DragDrop (1048653)
<aState> := { nKeyState, aPos }
<aState> contains information about keys pressed while the item is dropped, as well as about the mouse pointer position. nKeyState is a numeric value with the keys being held. It is a combination of the XBP_MK_xxx defines from XBP.CH. aPos is a two-dimensional array with the current x and y position of the mouse pointer.

The units used for reporting the mouse pointer position depends on the value assigned to :mouseMode. If XBPCRT_MOUSEMODE_VIO is assigned to this instance variable, the array contains a position in row/column format. Otherwise, the position is specified in pixel.

<oDragData> is an object encapsulating the actual data of the item that was dropped. It is an instance of the DragDataObject() class. The application can use the object's methods and member variables to examine the item's data format.

Both the code block and the method must return a numeric value represented by one of the XBP_DROPMODE_xxx constants defined in XBP.CH. The return value indicates whether the application supports dropping the item or items being dragged. If both a method and a code block have been defined, the value returned by the code block takes precedence.


The xbeP_DragDrop event is generated if an item which is dragged by the user is dropped over an XbpCrt object. If xbeP_DragDrop is received by an Xbase++ application, it must indicate to the data provider the actions taken on the item or items dropped. This is done by returning one of the following constants defined in XBP.CH.

Return values defined for xbeP_DragDrop
Constant Description
XBP_DROPMODE_NONE Error manipulating the data represented by the item(s)
XBP_DROPMODE_COPY *) Drop results in a copy of the item(s) dropped
XBP_DROPMODE_MOVE Data provider should remove its copy of the item(s)
XBP_DROPMODE_LINK Data provider should create a link to the original item(s)
  1. Default value

After the xbeP_DragDrop notification is processed by the application, the system removes all visual feedback on the drag-and-drop operation. and the mouse pointer is changed back the pointer assigned to the XbpCrt object. Please note that unlike with the return value for the xbeP_DragEnter or xbeP_DragMotion events, there's no visual indication to the user if a drag-and-drop operation succeeded!

The xbeP_DragDrop event is sent synchronously via the :handleEvent() method of an XbpCrt object. This means that xbeP_DragDrop is not retrieved by the AppEvent() function. As it is generated while the user manipulates an item, we strongly discourage to perform lengthy operations while processing the event.

An example that illustrates how to accept items being dragged can be found under :dropZone.

The xbeP_DragDrop event is generated only if the value .T. (true) is assigned to the object's :dropZone instance variable. Also, mouse events must be enabled using SetMouse(.T.).


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.