OLEGiveFeedback Event (ActiveX Controls)

       

Occurs after every OLEDragOver event. OLEGiveFeedback allows the source component to provide visual feedback to the user, such as changing the mouse cursor to indicate what will happen if the user drops the object, or provide visual feedback on the selection (in the source component) to indicate what will happen.

Syntax

Private Sub object_OLEGiveFeedback(effect As Long, defaultcursors As Boolean)

The OLEGiveFeedback event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
effect A long integer set by the target component in the OLEDragOver event specifying the action to be performed if the user drops the selection on it. This allows the source to take the appropriate action (such as giving visual feedback). The possible values are listed in Settings.
defaultcursors A boolean value which determines whether Visual Basic uses the default mouse cursor provided by the component, or uses a user-defined mouse cursor.
True (default) = use default mouse cursor.
False = do not use default cursor. Mouse cursor must be set with the MousePointer property of the Screen object.

Settings

The settings for effect are:

Constant Value Description
vbDropEffectNone 0 Drop target cannot accept the data.
vbDropEffectCopy 1 Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation.
vbDropEffectMove 2 Drop results in data being moved from drag source to drop source. The drag source should remove the data from itself after the move.
vbDropEffectScroll -2147483648

(&H80000000)

Scrolling is occurring or about to occur in the target component. This value is used in conjunction with the other values.

Note   Use only if you are performing your own scrolling in the target component.


Remarks

If there is no code in the OLEGiveFeedback event, or if the defaultcursors parameter is set to True, then Visual Basic automatically sets the mouse cursor to the default cursor provided by the component.

The source component should always mask values from the effect parameter to ensure compatibility with future implementations of components. Presently, only three of the 32 bits in the effect parameter are used. In future versions of Visual Basic, however, these other bits may be used. Therefore, as a precaution against future problems, drag sources and drop targets should mask these values appropriately before performing any comparisons.

For example, a source component should not compare an effect against, for example, vbDropEffectCopy, such as:

If Effect = vbDropEffectCopy... 

Instead, the source component should mask for the value or values being sought, as here:

If Effect And vbDropEffectCopy = vbDropEffectCopy... 

-or-

If (Effect And vbDropEffectCopy)... 

This allows for the definition of new drop effects in future versions of Visual Basic while preserving backwards compatibility with your existing code.

Most components support manual OLE drag and drop events, and some support automatic OLE drag and drop events.