Export (0) Print
Expand All

OLEGiveFeedback Event (ActiveX Controls)

Visual Studio .NET 2003

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
xxxDropEffectNone 0 Drop target cannot accept the data.
xxxDropEffectCopy 1 Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation.
xxxDropEffectMove 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.
xxxDropEffectScroll -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, mskDropEffectCopy, such as:

If Effect = mskDropEffectCopy... 

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

If Effect And mskDropEffectCopy = mskDropEffectCopy... 

-or-

If (Effect And mskDropEffectCopy)... 

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.

See Also

Applies To: Masked Edit Control | MSChart Control

Show:
© 2014 Microsoft