Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

OLEDragOver Event, SftMask Object

An object is dragged over the control.

Syntax

VB.NETPrivate Sub object_OLEDragOver(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEDragOver
VBPrivate Sub object_OLEDragOver(Data As DataObject, TargetChar As Long, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As SftMaskOLEDragOverConstants)
C#.NETvoid object_OLEDragOver(object sender, EventArgumentType e);
VC++void OnOLEDragOverobject(struct IVDMDataObject** Data, long* TargetChar, long* Effect, short* Button, short* Shift, float* x, float* y, enum SftMaskOLEDragOverConstants* State);
CHRESULT OnOLEDragOverobject(struct IVDMDataObject** Data, long* TargetChar, long* Effect, short* Button, short* Shift, float* x, float* y, enum SftMaskOLEDragOverConstants* State);

object

A SftMask object.

Data

A DataObject object containing formats that the source will provide and, in addition, possibly the data for those formats. If no data is contained in the DataObject, it is provided when the control calls the GetData method. The SetData and Clear methods cannot be used here.

TargetChar

Describes the default insertion point where the data is to be inserted. On return from the OLEDragOver event this insertion point will become the new insertion point. TargetChar can be modified to cause a different location to be the drop target. It can be set to -1 in which case no insertion point exists. Valid values for TargetChar are between -1 and Length(Text).

Effect

A Long variable set by the source object identifying all effects it supports. This parameter must be correctly set by the target component during this event. The value of Effect is determined by logically Or'ing together all active effects. The target component should check these effects and other parameters to determine which actions are appropriate for it, and then set this parameter to one of the allowable effects (as specified by the source) to specify which actions will be performed if the user drops the selection on the component.

EffectValueDescription
vbDropEffectNone0Drop target cannot accept the data.
vbDropEffectCopy1Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation.
vbDropEffectMove2Drop results in data being moved from the drag source to the drop source. The drag source should remove the data from itself after the move.

Note: Only Visual Basic offers the predefined constants vbDropEffectNone, etc. When using other languages, the constants have to be defined explicitly by the application.

Button

Describes the button(s) that are pressed. The Button argument is a bit field with bits corresponding to the left button, right button and middle button. These bits correspond to the values shown below. Only one of the bits is set, indicating the button that caused the event.

ButtonValueDescription
constSftMaskLeftButton1The left mouse button was pressed.
constSftMaskRightButton2The middle mouse button was pressed.
constSftMaskMiddleButton4The right mouse button was pressed.

Shift

Describes the state of the SHIFT, CONTROL and ALT keys. A bit is set if the key is down. The Shift argument is a bit field with bits corresponding to the SHIFT, CONTROL and ALT keys. It indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftMaskShiftMask1The SHIFT key is down.
constSftMaskCtrlMask2The CONTROL key is down.
constSftMaskAltMask4The ALT key is down.

x

The x coordinate of the mouse cursor. The units used depend on the container (Visual Basic, Visual C++, etc.) and the coordinate system used.

y

The y coordinate of the mouse cursor. The units used depend on the container (Visual Basic, Visual C++, etc.) and the coordinate system used.

State

Defines the transition state of the data being dragged in relation to the target control.

StateValueDescription
enterSftMask0Source component is being dragged within the range of a target.
leaveSftMask1Source component is being dragged out of the range of a target.
overSftMask2Source component has moved from one position in the target to another.

Comments

The OLEDragOver event occurs when an object is dragged over the control.

The source control should always mask values from the Effect parameter to insure compatibility with future implementations of OLE drag & drop. Presently, only three bits in the Effect parameter are used. In future versions other bits may be used. 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 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 while preserving compatibility with existing code.

Examples

VB.NET

        S = e.data.GetData(SftOLEClipboardConstants.sftCFText)
        AxSftMask1.SelStart = e.targetChar
        AxSftMask1.SelText = S
    Else
        e.effect = 0 ' vbDropEffectNone
    End If
End Sub

Private Sub AxAxSftMask1_OLEDragOver(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_OLEDragOverEvent) Handles AxSftMask1.OLEDragOver
    If e.targetChar < 0 Then
        ' Outside edit control (on caption)
        e.effect = 0 ' vbDropEffectNone
    Else
        ' Inside edit control
        If e.data.GetFormat(SftOLEClipboardConstants.sftCFText) Then
            ' OK, we have a text format

VB6

        S = Data.GetData(sftCFText)
        SftMask1.SelStart = TargetChar
        SftMask1.SelText = S
    Else
        Effect = vbDropEffectNone
    End If
End Sub

Private Sub SftMask1_OLEDragOver(Data As SftMaskLib70.DataObject, TargetChar As Long, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As SftMaskLib70.SftMaskOLEDragOverConstants)
    If TargetChar < 0 Then
        ' Outside edit control (on caption)
        Effect = vbDropEffectNone
    Else
        ' Inside edit control
        If Data.GetFormat(sftCFText) Then
            ' OK, we have a text format

C#

        s = (string) e.data.GetData(SftOLEClipboardConstants.sftCFText);
        axSftMask1.SelStart = e.targetChar;
        axSftMask1.SelText = s;
    } else {
        e.effect = 0; //vbDropEffectNone
    }
}

private void axSftMask1_OLEDragOver(object sender, AxSftMaskLib70._ISftMaskEvents_OLEDragOverEvent e)
{
    if (e.targetChar < 0) {
        // Outside edit control (on caption)
        e.effect = 0; //vbDropEffectNone
    } else {
        // Inside edit control
        if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {

C++

        _variant_t data = pData->GetData(_variant_t((long) sftCFText));
        data.ChangeType(VT_BSTR);
        m_pMask1->SelStart = *TargetChar;
        m_pMask1->SelText = data.bstrVal;
    } else
        *Effect = DROPEFFECT_NONE;
}

void CProject1Dlg::OnOLEDragOverSftMask1(LPDISPATCH FAR* Data, long FAR* TargetChar, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y, long FAR* State)
{
    IVDMDataObjectPtr pData = *Data;

    if (*TargetChar < 0) {
        // Outside edit control (on caption)
        *Effect = DROPEFFECT_NONE;
    } else {

See Also SftMask Events | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.