The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



SortCols


Unit:SDL_ntabed
Class: TNTabEd
Declaration: procedure SortCols (SortRowIx: integer; Ascending: boolean; LowCol, LowRow, HighCol, HighRow: integer; IncludeHeaders: boolean);

The method SortCols provides a means to sort the columns of the table editor, or part of it, according to the values in a single row. This row is specified by the parameter SortRowIx. The matrix is sorted column by column within the range [LowCol,LowRow] to [HighCol,HighRow]. The values outside this range are not affected (except for the row addressed by SortRowIx ). The sorting order is determined by the row SortRowIdx which is also sorted within the range [LowCol, HighCol ]. The parameter Ascending specifies whether the valus are to be sorted in ascending (TRUE) or descending (FALSE) order. The parameter IncludeHeaders determines whether the column names, decimal places, and columns attributes are sorted too. Note that in most cases this parameter should be set TRUE.

The sorting is performed by a modified bubble sort (CombSort), which has been reported to be comparable in speed to QuickSort (see also R.Box, S. Lacey, BYTE magazine, April 1991).

Hint: The values of the row SortRowIx are always sorted, even if this row is outside the specified sort range [LowRow, HighRow

Example: The statement NTEd1.SortCols (3, true, 1, 1, NTEd1.NrOfColumns, NTEd1.NrOfRows, true) sorts the whole matrix NTEd1 according to the values in Row 3.


Last Update: 2012-Oct-20