Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

CancelMode Method, SftTree Object

Cancels internal modes.

Syntax

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

object

A SftTree object.

Comments

The CancelMode method cancels internal modes.

Applications may wish to respond to events such as ItemClick or 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 tree control has to be cleared. This can be accomplished using the CancelMode method.

Examples

VB.NET

        End If

        ' determine item right-clicked
        Dim ItemIndex As Integer
        ItemIndex = AxSftTree1.Items.HitTestPix(e.x, e.y)
        If ItemIndex >= 0 And ItemIndex < AxSftTree1.Items.Count Then
            AxSftTree1.Items.Current = ItemIndex
            AxSftTree1.get_Item(ItemIndex).Selected = True
            AxSftTree1.CancelMode()
            ItemContextMenu.Show(Me, PointToClient(P))
        End If
    End Sub

    Private Sub menuHeader_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim mItem As MenuItem
        mItem = sender

VB6

    Else
        MenuForm.ShowContents.Enabled = True
        MenuForm.ShowDescription.Enabled = True
        MenuForm.ShowSize.Enabled = True
    End If

    MenuForm.ShowAll.Enabled = Count < 3

    SftTree1.CancelMode
    PopupMenu MenuForm.HeaderPopup
End Sub

Private Sub SftTree1_ContextMenu(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

    ' Determine click context menu for header or item
    Dim l As Single, t As Single, h As Single, w As Single

C#

                return;
            }

            // determine item right-clicked
            int ItemIndex = axSftTree1.Items.HitTestPix(e.x, e.y);
            if (ItemIndex >= 0 && ItemIndex < axSftTree1.Items.Count) {
                axSftTree1.Items.Current = ItemIndex;
                axSftTree1.get_Item(ItemIndex).Selected = true;
                axSftTree1.CancelMode();
                ItemContextMenu.Show(this, PointToClient(point));
            }
        }

        private void menuHeader_Click(object sender, System.EventArgs e) {
            MenuItem mItem = (MenuItem) sender;
            short colIndex = (short) mItem.Index;

C++

    m_HeaderMenu.AppendMenu(MF_SEPARATOR);

    m_HeaderMenu.AppendMenu(MF_STRING, HEADERMENU_SHOWALL, _T("&Show All"));
    if (count < m_vTree->ColumnsObj->Count)
        m_HeaderMenu.EnableMenuItem(HEADERMENU_SHOWALL, MF_ENABLED|MF_BYCOMMAND);
    else
        m_HeaderMenu.EnableMenuItem(HEADERMENU_SHOWALL, MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);

    m_vTree->CancelMode();

    m_HeaderMenu.TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON, pt.x, pt.y, this);
}

void CBookTableDlg::ItemMenu(CPoint pt)
{
    m_ItemMenu.DestroyMenu();

See Also SftTree Object | Object Hierarchy


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