Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

VirtualCount Method, SftTree Object

Defines the number of items in the control in virtual mode.

Syntax

VB.NETobject.VirtualCount(ByVal Total As Integer)
VBobject.VirtualCount(ByVal Total As Long)
C#.NETvoid object.VirtualCount(int Total);
VC++HRESULT object->VirtualCount(long Total);
CHRESULT object->raw_VirtualCount(long Total);

object

A SftTree object.

Total

The number of items in the control in virtual mode.

Comments

The VirtualCount method defines the number of items in the control in virtual mode.

The VirtualCount method defines the number of items when using a virtual data source. It specifies the current number of items to be managed by the tree control (including visible and hidden items).

If the tree control is not a virtual tree control (items have been added using Items.Add or Items.Insert), this method will fail.

Whenever the number of items in the virtual data source changes, the application can call this method to notify the tree control.

If the number of items is changed using VirtualCount, the tree control does not preserve the current index or the current selections. It is up to the application to preserve or update these.

The Items.Count property can be used to retrieve the current number of items.

Only flat lists (without hierarchy) are supported in virtual mode.

Examples

VB.NET

    Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
        Application.Exit()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        m_PicCount = 0
        AxSftTree1.VirtualMode = True
        AxSftTree1.VirtualCount(10000000)
        AxSftTree1.VirtualImageSizes(16, 16, 16, 16, 16, 16, 16, 16)
        ' Make columns and row headers optimal
        ' but do this at the end of the list, because our sample
        ' data is larger at the end
        AxSftTree1.Items.TopIndex = AxSftTree1.Items.Count - 1
        AxSftTree1.ColumnsObj.MakeOptimal()
        AxSftTree1.RowHeaders.MakeOptimal()
        AxSftTree1.Items.RecalcHorizontalExtent()

VB6

Private Sub Command1_Click()
    End
End Sub

Private Sub Form_Load()
    PicCount = 0
    With SftTree1
        .VirtualMode = True
        .VirtualCount 10000000
        .VirtualImageSizes 16, 16, 16, 16, 16, 16, 16, 16
        ' Make columns and row headers optimal
        ' but do this at the end of the list, because our sample
        ' data is larger at the end
        .Items.TopIndex = .Items.Count - 1
        .ColumnsObj.MakeOptimal
        .RowHeaders.MakeOptimal

C#

        private void Command1_Click(object sender, System.EventArgs e) {
            Application.Exit();
        }

        private void Form1_Load(object sender, System.EventArgs e) {
            m_PicCount = 0;
            axSftTree1.VirtualMode = true;
            axSftTree1.VirtualCount(10000000);
            axSftTree1.VirtualImageSizes(16, 16, 16, 16, 16, 16, 16, 16);
            // Make columns and row headers optimal
            // but do this at the end of the list, because our sample
            // data is larger at the end
            axSftTree1.Items.TopIndex = axSftTree1.Items.Count - 1;
            axSftTree1.ColumnsObj.MakeOptimal();
            axSftTree1.RowHeaders.MakeOptimal();
            axSftTree1.Items.RecalcHorizontalExtent();

C++

    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);            // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon

    m_vTree = m_Tree.GetControlUnknown();
    ASSERT(m_vTree != NULL);

    m_vTree->VirtualMode = VARIANT_TRUE;
    m_vTree->VirtualCount(10000000);
    m_vTree->VirtualImageSizes(16, 16, 16, 16, 16, 16, 16, 16);
    // Make columns and row headers optimal
    // but do this at the end of the list, because our sample
    // data is larger at the end
    m_vTree->Items->TopIndex = m_vTree->Items->Count - 1;
    m_vTree->ColumnsObj->MakeOptimal();
    m_vTree->RowHeaders->MakeOptimal();

See Also SftTree Object | Object Hierarchy


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