Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Count Property, SftTreeItems Object

Returns the number of items in the tree control.

Syntax

Get

VB.NETCount = object.Count As Integer
VBCount = object.Count As Long
C#.NETint Count = object.Count;
VC++long Count = object->Count;
long Count = object->GetCount();
CHRESULT object->get_Count(long* Count);

object

A SftTreeItems object.

Count

Returns the number of items in the tree control.

Comments

The Count property returns the number of items in the tree control.

The Items.Add and Items.Insert methods add new items.

Examples

VB.NET

        If e.x >= L And e.x < L + W And e.y >= T And e.y <= T + H Then
            HeaderMenu(PointToClient(P))
            Return
        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

VB6

    If X >= l And X < l + w And Y >= t And Y <= t + h Then
        HeaderMenu
        Exit Sub
    End If

    ' determine item right-clicked
    Dim ItemIndex As Long
    ItemIndex = SftTree1.Items.HitTest(X, Y)
    If ItemIndex >= 0 And ItemIndex < SftTree1.Items.Count Then
        SftTree1.Items.Current = ItemIndex
        SftTree1.Item(ItemIndex).Selected = True
        SftTree1.CancelMode
        PopupMenu MenuForm.ItemPopup
    End If
End Sub

C#

            axSftTree1.Headers.GetPositionPix(out l, out t, out w, out h);
            if (e.x >= l && e.x < l + w && e.y >= t && e.y <= t + h) {
                HeaderMenu(PointToClient(point));
                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));
            }
        }

C++

    if (x >= l && x < l + w && y >= t && y <= t + h) {
        HeaderMenu(pt);
        return;
    }

    // determine item right-clicked
    long ItemIndex;
    ItemIndex = m_vTree->Items->HitTestPix(x, y);
    if (ItemIndex >= 0 && ItemIndex < m_vTree->Items->Count) {
        m_vTree->Items->Current = ItemIndex;
        m_vTree->Item[ItemIndex]->Selected = VARIANT_TRUE;
        ItemMenu(pt);
        return;
    }
}

See Also SftTreeItems Object | Object Hierarchy


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