Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxItems.Sort Method

Sorts items.

Syntax

VB.NETobject.Sort(ByVal ItemIndex As Integer, ByVal ColNum As Short, ByVal SortType As SftBoxSortConstants)
VBobject.Sort(ByVal ItemIndex As Long, ByVal ColNum As Integer, ByVal SortType As SftBoxSortConstants)
C#.NETvoid object.Sort(int ItemIndex, short ColNum, SftBoxSortConstants SortType);
VC++HRESULT object->Sort(long ItemIndex, short ColNum, enum SftBoxSortConstants SortType);
CHRESULT object->raw_Sort(long ItemIndex, short ColNum, enum SftBoxSortConstants SortType);

object

A SftBoxItems object.

ItemIndex

The zero-based index of the item whose dependents are to be sorted. Specify -1 to sort all items.

ColNum

The zero-based index of the column whose contents are to be used for sorting purposes.

SortType

Defines the sorting method used.

NameValueDescription
sortSftBoxAscending0Items defined by ItemIndex are sorted using the Cell.Text property in column ColNum, in ascending fashion. The SortCompare event is not used.
sortSftBoxDescending1Items defined by ItemIndex are sorted using the Cell.Text property in column ColNum, in descending fashion. The SortCompare event is not used.
sortSftBoxCellValueAscending2Items defined by ItemIndex are sorted using the Cell.Data property in column ColNum, in ascending fashion. The SortCompare event is not used.
sortSftBoxCellValueDescending3Items defined by ItemIndex are sorted using the Cell.Data property in column ColNum, in descending fashion. The SortCompare event is not used.
sortSftBoxItemTagStringAscending4Items defined by ItemIndex are sorted using the Item.DataTag property, in ascending fashion. The Item.DataTag property is interpreted as a string. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagStringDescending5Items defined by ItemIndex are sorted using the Item.DataTag property, in descending fashion. The Item.DataTag property is interpreted as a string. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagLongAscending6Items defined by ItemIndex are sorted using the Item.DataTag property, in ascending fashion. The Item.DataTag property is interpreted as a Long value. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagLongDescending7Items defined by ItemIndex are sorted using the Item.DataTag property, in descending fashion. The Item.DataTag property is interpreted as a Long value. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTag8Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text, Item.DataTag and Cell(ColNum).Data properties for each item as arguments.
sortSftBoxCellTag9Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text, Cell(ColNum).DataTag and Cell(ColNum).Data properties for each item as arguments.
sortSftBoxCellText10Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text properties for each item as arguments. The parameters vData and Value of the SortCompare event are not used.

Comments

The Sort method sorts items.

Based on the specified column number ColNum, the immediate dependents of the specified item ItemIndex are sorted according to the SortType specified. To sort all items specify ItemIndex as -1.

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 Sort method separately for each parent item to be sorted.

Examples

VB.NET

        AxSftBox1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortDesc
    End If
    m_SortDirection = Ascending
End Sub

Private Sub SetSortDirection(ByVal NewDirection As Boolean)
    ShowSortDirection(NewDirection)
    If NewDirection Then
        AxSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending)
    Else
        AxSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxDescending)
    End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

VB6

        SftBox1.Header(0).Image.Appearance = sftImageSortDesc
    End If
    SortDirection = Ascending
End Sub

Private Sub SetSortDirection(ByVal NewDirection As Boolean)
    ShowSortDirection NewDirection
    If NewDirection Then
        SftBox1.Items.Sort -1, 0, sortSftBoxAscending
    Else
        SftBox1.Items.Sort -1, 0, sortSftBoxDescending
    End If
End Sub


Private Sub Command1_Click()

C#

        axSftBox1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortDesc;
    m_SortDirection = Ascending;
}

private void SetSortDirection(bool NewDirection)
{
    ShowSortDirection(NewDirection);
    if (NewDirection)
        axSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending);
    else
        axSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxDescending);
}

private void Form1_Load(object sender, System.EventArgs e) {

    int ItemIndex = axSftBox1.Items.Add("Supported Picture Types");

C++

        m_vBox->Header[0]->Image->Appearance = sftImageSortDesc;
    m_fSortDirection = fAscending;
}

void CPicturesDlg::SetSortDirection(BOOL fNewDirection)
{
    ShowSortDirection(fNewDirection);
    if (fNewDirection)
        m_vBox->Items->Sort(-1, 0, sortSftBoxAscending);
    else
        m_vBox->Items->Sort(-1, 0, sortSftBoxDescending);
}

void CPicturesDlg::ToggleImage(ISftPictureObjectPtr pImg)
{
    SftPictureImageConstants Appearance = pImg->Appearance;

See Also SftBoxItems Object | Object Hierarchy


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