Hide

SftButton/OCX 3.0 - Button Control

Display
Print

CancelMode Method, SftButton Object

Cancels current processing modes.

Syntax

VB.NETobject.CancelMode()
VBobject.CancelMode
C#.NETvoid object.CancelMode();
VC++HRESULT object->CancelMode();
CHRESULT object->raw_CancelMode();

object

A SftButton object.

Comments

The CancelMode method cancels current processing modes.

Applications may wish to respond to events such as MouseDown. Many mouse related events may have built-in functions, particularly drag & drop operations may be started after these events are processed. If an application wants to suppress the built-in behavior, e.g. to display a context menu, the internal state of the control has to be cleared. This can be accomplished using the CancelMode method.

Examples

VB.NET

End Sub

Private Sub AxSftButton1_DropDownClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton1.DropDownClick
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim pt As Point = New Point(AxSftButton1.Location.X + AxSftButton1.Size.Width, _
                            AxSftButton1.Location.Y + AxSftButton1.Size.Height)
    pt = PointToScreen(pt)
    AxSftButton1.CancelMode()
    TrackPopupMenu(ContextMenu1.Handle, Convert.ToUInt32(TPM_RIGHTALIGN Or TPM_TOPALIGN Or TPM_LEFTBUTTON), pt.X, pt.Y, 0, Me.Handle, IntPtr.Zero)
End Sub

Private Sub AxSftButton2_DropDownClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton2.DropDownClick
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim pt As Point = New Point(AxSftButton2.Location.X + AxSftButton2.Size.Width, _

C#

private void axSftButton1_DropDownClick(object sender, System.EventArgs e)
{
    // The drop down button was clicked. Display a popup menu
    // right-aligned with the right edge of the button
    Point pt = new Point(axSftButton1.Location.X + axSftButton1.Size.Width,
                            axSftButton1.Location.Y + axSftButton1.Size.Height);
    pt = PointToScreen(pt);
    axSftButton1.CancelMode();
    TrackPopupMenu(contextMenu1.Handle, TPM_RIGHTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.X, pt.Y, 0, this.Handle, IntPtr.Zero);
}

private void axSftButton2_ClickEvent(object sender, System.EventArgs e)
{
    // Invoke the default action, because the button was clicked
    menuItem1_Click(axSftButton2, new System.EventArgs());
}

See Also SftButton Object | Object Hierarchy


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