Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

SortIndicators Property, SftTreeHeaders Object

Defines whether sort indicators are shown.

Syntax

Get

VB.NETStyle = object.SortIndicators As SftTreeHeaderSortIndicatorsConstants
VBStyle = object.SortIndicators As SftTreeHeaderSortIndicatorsConstants
C#.NETSftTreeHeaderSortIndicatorsConstants Style = object.SortIndicators;
VC++enum SftTreeHeaderSortIndicatorsConstants Style = object->SortIndicators;
enum SftTreeHeaderSortIndicatorsConstants Style = object->GetSortIndicators();
CHRESULT object->get_SortIndicators(enum SftTreeHeaderSortIndicatorsConstants* Style);

Put

VB.NETobject.SortIndicators = Style As SftTreeHeaderSortIndicatorsConstants
VBobject.SortIndicators = Style As SftTreeHeaderSortIndicatorsConstants
C#.NETSftTreeHeaderSortIndicatorsConstants object.SortIndicators = Style;
VC++enum SftTreeHeaderSortIndicatorsConstants object->SortIndicators = Style;
void object->PutSortIndicators(enum SftTreeHeaderSortIndicatorsConstants Style);
CHRESULT object->put_SortIndicators(enum SftTreeHeaderSortIndicatorsConstants Style);

object

A SftTreeHeaders object.

Style

Defines whether sort indicators are shown.

StyleValueDescription
headerSortIndicatorsSftTreeNone0None. Sort indicators are not displayed.
headerSortIndicatorsSftTreeAuto1Automatic. Sort indicators are displayed and the tree control automatically responds to mouse button clicks to change sort order and sorted column.
headerSortIndicatorsSftTreeManual2Manual. Sort indicators are displayed but the tree control does not automatically respond to mouse button clicks to change sort order and sorted column.

Comments

The SortIndicators property defines whether sort indicators are shown.

The tree control will never automatically sort the data.

With headerSortIndicatorsSftTreeAuto the tree control automatically updates sort indicators in response to mouse clicks. The ItemClick event (AreaType = constSftTreeColumnHeader) can be used to determine when the header was clicked, meaning the sort indicator was clicked. The Header.SortIndicator property can be used to determine the status of sort indicators when handling the ItemClick event. The application has to sort the data based on the sort indicators, usually using the Items.SortDependents method.

With headerSortIndicatorsSftTreeManual the application must change sort indicators explicitly. The Header.SortIndicator property can be used to update the status of sort indicators. The application has to sort the data based on the sort indicators, usually using the Items.SortDependents method.

Examples

VB.NET

        AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False)
        ItemIndex = AxSftTree1.Items.ItemIndex(m_SavedFolder)
        AxSftTree1.get_Item(ItemIndex).Collapse(False)
        m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0)
        AxSftTree1.ColumnsObj.MakeOptimal()
        AxSftTree1.Items.RecalcHorizontalExtent()
        AxSftTree1.Splitter.MakeOptimal()
        ' allow sorting
        AxSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto

        AxSftTree1.Items.Current = 0
        AxSftTree1_CaretChange(Me, New _DSftTreeEvents_CaretChangeEvent(0))
    End Sub

    Private Sub AxSftTree1_CaretChange(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_CaretChangeEvent) Handles AxSftTree1.CaretChange
        ' set column headers based on selected item

VB6

            AddMessage 1, "me@mycompany.com", "You're hired", "10/01/05", 4, False
            AddMessage 1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False
            .Item(.Items.ItemIndex(SavedFolder)).Collapse False
        DeletedFolder = AddFolder("Deleted", "Deleted messages", 0)
        .ColumnsObj.MakeOptimal
        .Items.RecalcHorizontalExtent
        .Splitter.MakeOptimal
        ' allow sorting
        .Headers.SortIndicators = headerSortIndicatorsSftTreeAuto

        .Items.Current = 0
        SftTree1_CaretChange 0  ' to update column headers
    End With
End Sub

Private Sub SftTree1_CaretChange(ByVal ItemIndex As Long)

C#

                AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, false);
                ItemIndex = axSftTree1.Items.get_ItemIndex(m_SavedFolder);
                axSftTree1.get_Item(ItemIndex).Collapse(false);
            m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0);
            axSftTree1.ColumnsObj.MakeOptimal();
            axSftTree1.Items.RecalcHorizontalExtent();
            axSftTree1.Splitter.MakeOptimal();
            // allow sorting
            axSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto;

            axSftTree1.Items.Current = 0;
            axSftTree1_CaretChange(this, new _DSftTreeEvents_CaretChangeEvent(0));
        }

        private int AddFolder(string Folder, string Desc, int Count)
        {

C++

        AddMessage(1, _T("me@mycompany.com"), _T("You're hired"), _T("10/01/05"), 4, FALSE);
        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_SavedFolder]]->Collapse(VARIANT_FALSE);
    m_DeletedFolder = AddFolder(_T("Deleted"), _T("Deleted messages"), 0);
    m_vTree->ColumnsObj->MakeOptimal();
    m_vTree->Items->RecalcHorizontalExtent();
    m_vTree->Splitter->MakeOptimal();
    // allow sorting
    m_vTree->Headers->SortIndicators = headerSortIndicatorsSftTreeAuto;

    m_vTree->Items->Current = 0;
    OnCaretChangeSftTree1(0); // to update column headers

    return TRUE;  // return TRUE  unless you set the focus to a control
}

See Also SftTreeHeaders Object | Object Hierarchy


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