MTblSortRange
bOk = MTblSortRange( hWndTbl, hWndaCols[*], naColSortFlags[*], nMinRow, nMaxRow )
Sorts a range of rows in a table.
Parameters
hWndTbl
Window Handle: Handle of the table
hWndaCols[*]
Array of Window Handle: Handles of the columns to sort.
naColSortFlags[*]
Array of Number: Column sort flags.
nMinRow
Number: First row ( including ) or TBL_Error to sort from the begin of the table
nMaxRow
Number: Last row ( including ) or TBL_Error to sort to the end of the table
Return
Boolean: TRUE if successful or FALSE if an error occurs
Example
In this example a table is sorted from row 0 to row 20 by two columns, the first ascending with default data type and the second descending with custom data type. We assume that the second column contains month names, e.g. "January" or "December".
If NOT SalArrayIsEmpty( hWndaCols )
Call SalArraySetUpperBound( hWndaCols, 1, -1 )
Set hWndaCols[0] = col1
Set naSortFlags[0] = MTS_ASC | MTS_DT_DEFAULT
Set hWndaCols[1] = col2
Set naSortFlags[1] = MTS_DESC | MTS_DT_CUSTOM
Call MTblSortRange( hWndTbl, hWndaCols, naSortFlags, 0, 20 )
Child Table: tbl1
Message Actions:
On MTM_QuerySortValue
Set hWndCol = SalNumberToWindowHandle( wParam )
SalGetItemName( hWndCol, sItemName )
If sItemName = "col2"
! GetMonthNr returns the month number, e.g. 1 for "January" and 12 for "December"
Return GetMonthNr( col2 )
Remarks
Split rows are not supported.
If you're using row hierarchy, you can restore the hierarchical structure with a call to MTblSortTree.
See also
Extended sorting
Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation