Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsDragSourceMBS class.

WindowsDragSourceMBS.GiveFeedback(Effect as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Drag & Drop MBS Win Plugin 10.5 ❌ No ✅ Yes ❌ No ❌ No
Enables a source application to give visual feedback to the end user during a drag-and-drop operation by providing the DoDragDrop function with an enumeration value specifying the visual effect.

Effect: The drop effect value returned by the most recent call to WindowsDropTargetMBS.DragEnter, WindowsDropTargetMBS.DragOver, or WindowsDropTargetMBS.DragLeave.

Return S_OK on success. Return DRAGDROP_S_USEDEFAULTCURSORS to indicate successful completion of the method, and requests OLE to update the cursor using the OLE-provided default cursors.

When your application detects that the user has started a drag-and-drop operation, it should call the DoDragDrop function. DoDragDrop enters a loop, calling WindowsDropTargetMBS.DragEnter when the mouse first enters a drop target window, WindowsDropTargetMBS.DragOver when the mouse changes its position within the target window, and WindowsDropTargetMBS.DragLeave when the mouse leaves the target window.

For every call to either WindowsDropTargetMBS.DragEnter or WindowsDropTargetMBS.DragOver, DoDragDrop calls WindowsDropTargetMBS.GiveFeedback, passing it the drop effect value returned from the drop target call.

DoDragDrop calls WindowsDropTargetMBS.DragLeave when the mouse has left the target window. Then, DoDragDrop calls WindowsDropTargetMBS.GiveFeedback and passes the DROPEFFECT_NONE value in the dwEffect parameter.

The Effect parameter can include DROPEFFECT_SCROLL, indicating that the source should put up the drag-scrolling variation of the appropriate pointer.

Notes to Implementers

This function is called frequently during the DoDragDrop loop, so you can gain performance advantages if you optimize your implementation as much as possible.

GiveFeedback is responsible for changing the cursor shape or for changing the highlighted source based on the value of the dwEffect parameter. If you are using default cursors, you can return DRAGDROP_S_USEDEFAULTCURSORS, which causes OLE to update the cursor for you, using its defaults.

Some examples using this event:

WindowsDragSourceMBS.QueryContinueDrag(EscapePressed as boolean, KeyState as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Drag & Drop MBS Win Plugin 10.5 ❌ No ✅ Yes ❌ No ❌ No
Determines whether a drag-and-drop operation should be continued, canceled, or completed. You do not call this method directly.

The OLE DoDragDrop function calls this method during a drag-and-drop operation.

EscapePressed: Indicates whether the Esc key has been pressed since the previous call to QueryContinueDrag or to DoDragDrop if this is the first call to QueryContinueDrag. A true value indicates the end user has pressed the escape key; a false value indicates it has not been pressed.

KeyState: The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.

This event can return the following values.

Return codeDescription
S_OKThe drag operation should continue. This result occurs if no errors are detected, the mouse button starting the drag-and-drop operation has not been released, and the Esc key has not been detected.
DRAGDROP_S_DROPThe drop operation should occur completing the drag operation. This result occurs if KeyState indicates that the key that started the drag-and-drop operation has been released.
DRAGDROP_S_CANCELThe drag operation should be canceled with no drop operation occurring. This result occurs if EscapePressed is true, indicating the Esc key has been pressed.

The DoDragDrop function calls QueryContinueDrag whenever it detects a change in the keyboard or mouse button state during a drag-and-drop operation. QueryContinueDrag must determine whether the drag-and-drop operation should be continued, canceled, or completed based on the contents of the parameters KeyState and EscapePressed.

Some examples using this event:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...