Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Collapse Method, SftTreeItem Object

Collapses the item so its dependents are no longer visible.

Syntax

VB.NETobject.Collapse(ByVal Preserve As Boolean)
VBobject.Collapse(ByVal Preserve As Boolean)
C#.NETvoid object.Collapse(bool Preserve);
VC++HRESULT object->Collapse(VARIANT_BOOL Preserve);
CHRESULT object->raw_Collapse(VARIANT_BOOL Preserve);

object

A SftTreeItem object.

Preserve

Defines whether the expand/collapse state is preserved.

PreserveDescription
TruePreserves the expand/collapse state of dependent items that are made no longer visible. A subsequent call to Items.Expand or Item.Expand will restore the items with the remembered expand/collapse state.
FalseThe expand/collapse state is not preserved.

Comments

The Collapse method collapses the item so its dependents are no longer visible.

The Collapse method collapses all dependent items of the item and saves the expand/collapse state of all dependent items, so it can be restored by a subsequent Items.Expand or Item.Expand method call.

If a parent item is collapsed, subsequently adding child items will automatically expand the item.

Examples

VB.NET

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ItemIndex As Integer
        m_InboxFolder = AddFolder("Inbox", "Viewed and unviewed mail", 10)
        AddMessage(1, "support@softelvdm.com", "Re: A support question", "10/09/05", 88, True)
        AddMessage(1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, False)
        AddMessage(1, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, True)
        AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False)
        ItemIndex = AxSftTree1.Items.ItemIndex(m_InboxFolder)
        AxSftTree1.get_Item(ItemIndex).Collapse(False)
        m_OutboxFolder = AddFolder("Outbox", "Mail about to be sent", 2)
        AddMessage(1, "me@mycompany.com", "Re: You're fired", "10/11/05", 5, False)
        AddMessage(1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, False)
        ItemIndex = AxSftTree1.Items.ItemIndex(m_OutboxFolder)
        AxSftTree1.get_Item(ItemIndex).Collapse(False)
        m_SavedFolder = AddFolder("Saved", "Saved messages", 2)
        AddMessage(1, "me@mycompany.com", "A support question", "10/09/05", 3, False)

VB6

Private Sub Form_Load()
    With SftTree1
        InboxFolder = AddFolder("Inbox", "Viewed and unviewed mail", 10)
            AddMessage 1, "support@softelvdm.com", "Re: A support question", "10/09/05", 88, True
            AddMessage 1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, False
            AddMessage 1, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, True
            AddMessage 1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False
            .Item(.Items.ItemIndex(InboxFolder)).Collapse False
        OutboxFolder = AddFolder("Outbox", "Mail about to be sent", 2)
            AddMessage 1, "me@mycompany.com", "Re: You're fired", "10/11/05", 5, False
            AddMessage 1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, False
            .Item(.Items.ItemIndex(OutboxFolder)).Collapse False
        SavedFolder = AddFolder("Saved", "Saved messages", 2)
            AddMessage 1, "me@mycompany.com", "A support question", "10/09/05", 3, False
            AddMessage 2, "support@softelvdm.com", "Re: A support question", "10/09/05", 88, True
            AddMessage 3, "me@mycompany.com", "Re: A support question", "10/09/05", 3, False

C#

        private void Form1_Load(object sender, System.EventArgs e) {
            int ItemIndex;
            m_InboxFolder = AddFolder("Inbox", "Viewed and unviewed mail", 10);
                AddMessage(1, "support@softelvdm.com", "Re: A support question", "10/09/05", 88, true);
                AddMessage(1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, false);
                AddMessage(1, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, true);
                AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, false);
                ItemIndex = axSftTree1.Items.get_ItemIndex(m_InboxFolder);
                axSftTree1.get_Item(ItemIndex).Collapse(false);
            m_OutboxFolder = AddFolder("Outbox", "Mail about to be sent", 2);
                AddMessage(1, "me@mycompany.com", "Re: You're fired", "10/11/05", 5, false);
                AddMessage(1, "anyone@acompany.com", "Re: Why did you say that", "10/10/05", 5, false);
                ItemIndex = axSftTree1.Items.get_ItemIndex(m_OutboxFolder);
                axSftTree1.get_Item(ItemIndex).Collapse(false);
            m_SavedFolder = AddFolder("Saved", "Saved messages", 2);
                AddMessage(1, "me@mycompany.com", "A support question", "10/09/05", 3, false);

C++

    m_pBoldCellFont->put_Bold(TRUE);


    m_InboxFolder = AddFolder(_T("Inbox"), _T("Viewed and unviewed mail"), 10);
        AddMessage(1, _T("support@softelvdm.com"), _T("Re: A support question"), _T("10/09/05"), 88, TRUE);
        AddMessage(1, _T("anyone@acompany.com"), _T("Re: Why did you say that"), _T("10/10/05"), 5, FALSE);
        AddMessage(1, _T("anyone@acompany.com"), _T("Re: You're fired"), _T("10/11/05"), 82, TRUE);
        AddMessage(1, _T("anyone@acompany.com"), _T("Re: You're hired"), _T("10/11/05"), 6, FALSE);
        m_vTree->Item[m_vTree->Items->ItemIndex[m_InboxFolder]]->Collapse(VARIANT_FALSE);
    m_OutboxFolder = AddFolder(_T("Outbox"), _T("Mail about to be sent"), 2);
        AddMessage(1, _T("me@mycompany.com"), _T("Re: You're fired"), _T("10/11/05"), 5, FALSE);
        AddMessage(1, _T("anyone@acompany.com"), _T("Re: Why did you say that"), _T("10/10/05"), 5, FALSE);
        m_vTree->Item[m_vTree->Items->ItemIndex[m_OutboxFolder]]->Collapse(VARIANT_FALSE);
    m_SavedFolder = AddFolder(_T("Saved"), _T("Saved messages"), 2);
        AddMessage(1, _T("me@mycompany.com"), _T("A support question"), _T("10/09/05"), 3, FALSE);
        AddMessage(2, _T("support@softelvdm.com"), _T("Re: A support question"), _T("10/09/05"), 88, TRUE);

See Also SftTreeItem Object | Object Hierarchy


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