Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

SortDependents Method, SftTreeItems Object

Sorts an item's dependents.

Syntax

VB.NETResult = object.SortDependents(ByVal ItemIndex As Integer, ByVal ColIndex As Short, ByVal SortType As SftTreeSortTypeConstants) As Boolean
VBResult = object.SortDependents(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal SortType As SftTreeSortTypeConstants) As Boolean
C#.NETbool Result = object.SortDependents(int ItemIndex, short ColIndex, SftTreeSortTypeConstants SortType);
VC++VARIANT_BOOL Result = object->SortDependents(long ItemIndex, short ColIndex, enum SftTreeSortTypeConstants SortType);
CHRESULT object->raw_SortDependents(long ItemIndex, short ColIndex, enum SftTreeSortTypeConstants SortType, VARIANT_BOOL* Result);

object

A SftTreeItems object.

ItemIndex

The zero-based index of the item whose immediate dependents are to be sorted. If ItemIndex is -1, the items on the root level (level 0) are sorted.

ColIndex

The zero-based column number to be sorted.

SortType

The sort method to be used.

SortTypeValueDescription
sortSftTreeAscending0The immediate dependents are sorted in an ascending fashion (not case sensitive) based on their cell text in column ColIndex.
sortSftTreeDescending1The immediate dependents are sorted in a descending fashion (not case sensitive) based on their cell text in column ColIndex.
sortSftTreeAscItemData2The immediate dependents are sorted in an ascending fashion based on their Item.Data property value (ColIndex is ignored, but must be valid).
sortSftTreeDscItemData3The immediate dependents are sorted in a descending fashion based on their Item.Data property value (ColIndex is ignored, but must be valid).
sortSftTreeAscItemDataFloat4The immediate dependents are sorted in an ascending fashion based on their Item.DataFloat property value (ColIndex is ignored, but must be valid).
sortSftTreeDscItemDataFloat5The immediate dependents are sorted in a descending fashion based on their Item.DataFloat property value (ColIndex is ignored, but must be valid).
sortSftTreeEvent6The immediate dependents are sorted in a fashion determined by the SortCompare event. The SortCompare event is generated to compare two items. It is only generated for a SortType of sortSftTreeEvent, sortSftTreeEventCell or sortSftTreeEventWithIndex. For other SortType values, the event is not generated.
sortSftTreeEventCell7The immediate dependents are sorted in a fashion determined by the SortCompare event. The SortCompare event is generated to compare two items. It is only generated for a SortType of sortSftTreeEvent, sortSftTreeEventCell or sortSftTreeEventWithIndex. For other SortType values, the event is not generated.
sortSftTreeAscCellItemData8The immediate dependents are sorted in an ascending fashion based on their Cell.Data property value.
sortSftTreeDscCellItemData9The immediate dependents are sorted in a descending fashion based on their Cell.Data property value.
sortSftTreeAscItemDataString10The immediate dependents are sorted in an ascending fashion based on their Item.DataString property value (ColIndex is ignored, but must be valid).
sortSftTreeDscItemDataString11The immediate dependents are sorted in a descending fashion based on their Item.DataString property value (ColIndex is ignored, but must be valid).
sortSftTreeEventWithIndex12The immediate dependents are sorted in a fashion determined by the SortCompare event. The SortCompare event is generated to compare two items. It is only generated for a SortType of sortSftTreeEvent, sortSftTreeEventCell or sortSftTreeEventWithIndex. For other SortType values, the event is not generated.

Result

Returns True if sorting was successful, False if the sorting process ran out of memory.

Comments

The SortDependents method sorts an item's dependents.

Based on the specified column number ColIndex, the immediate dependents of the specified item ItemIndex are sorted according to the SortType specified.

When sorting dependents, only immediate dependents are sorted, i.e., items on the immediate lower level. Dependents of items being sorted are moved with their parent item, but are not sorted. Invoke the SortDependents method separately for each parent item to be sorted.

Examples

VB.NET

        Dim SortedColumn As Integer
        ' get the new, sorted column
        SortedColumn = AxSftTree1.Headers.SortedColumn
        If SortedColumn >= 0 Then
            ' Sort the data. Note that column 2 is sorted by Item.Data, which is
            ' an integer value (book size in pages)
            If AxSftTree1.get_Header(SortedColumn).SortIndicator = SftTreeSortIndicatorConstants.sortIndicatorSftTreeAscending Then
                If SortedColumn = 2 Then
                    AxSftTree1.Items.SortDependents(-1, SortedColumn, SftTreeSortTypeConstants.sortSftTreeAscItemData)
                Else
                    AxSftTree1.Items.SortDependents(-1, SortedColumn, SftTreeSortTypeConstants.sortSftTreeAscending)
                End If
            Else
                If SortedColumn = 2 Then
                    AxSftTree1.Items.SortDependents(-1, SortedColumn, SftTreeSortTypeConstants.sortSftTreeDscItemData)
                Else

VB6

    With SftTree1
        Dim SortedColumn As Integer
        ' get the new, sorted column
        SortedColumn = .Headers.SortedColumn
        ' Sort the data based on the sort indicator
        ' Note that column 2 is sorted by Item.Data, which is an integer value (book size in pages)
        If .Header(SortedColumn).SortIndicator = sortIndicatorSftTreeAscending Then
            If SortedColumn = 2 Then
                .Items.SortDependents -1, SortedColumn, sortSftTreeAscItemData
            Else
                .Items.SortDependents -1, SortedColumn, sortSftTreeAscending
            End If
        Else
            If SortedColumn = 2 Then
                .Items.SortDependents -1, SortedColumn, sortSftTreeDscItemData
            Else

C#

        private void SortHeader(short ColNum) {
            // get the new, sorted column
            short sortedColumn = axSftTree1.Headers.SortedColumn;
            // Sort the data based on the sort indicator
            // Note that column 2 is sorted by Item.Data, which is an integer value (book size in pages)
            if (axSftTree1.get_Header(sortedColumn).SortIndicator == SftTreeSortIndicatorConstants.sortIndicatorSftTreeAscending) {
                if (sortedColumn == 2)
                    axSftTree1.Items.SortDependents(-1, sortedColumn, SftTreeSortTypeConstants.sortSftTreeAscItemData);
                else
                    axSftTree1.Items.SortDependents(-1, sortedColumn, SftTreeSortTypeConstants.sortSftTreeAscending);
            } else {
                // Sort the data. Note that column 2 is sorted by Item.Data, which is
                // an integer value (book size in pages)
                if (sortedColumn == 2)
                    axSftTree1.Items.SortDependents(-1, sortedColumn, SftTreeSortTypeConstants.sortSftTreeDscItemData);
                else

C++

{
	// get the new, sorted column
    int sortedColumn = m_vTree->Headers->SortedColumn;

    // Sort the data based on the sort indicator
    // Note that column 2 is sorted by Item.Data, which is an integer value (book size in pages)
    if (m_vTree->Header[sortedColumn]->SortIndicator == sortIndicatorSftTreeAscending) {
        if (sortedColumn == 2)
            m_vTree->Items->SortDependents(-1, sortedColumn, sortSftTreeAscItemData);
        else
            m_vTree->Items->SortDependents(-1, sortedColumn, sortSftTreeAscending);
    } else {
        if (sortedColumn == 2)
            m_vTree->Items->SortDependents(-1, sortedColumn, sortSftTreeDscItemData);
        else
            m_vTree->Items->SortDependents(-1, sortedColumn, sortSftTreeDescending);

See Also SftTreeItems Object | Object Hierarchy


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