Spread 8.0 Documentation
SSGetColUserSortIndicator, SSSetColUserSortIndicator Functions
Support Options
DLL Reference > DLL Functions > SSGetColUserSortIndicator, SSSetColUserSortIndicator Functions

Glossary Item Box

SSGetColUserSortIndicator, SSSetColUserSortIndicator Functions


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Sets or returns the sort indicator to display.

Syntax

C

short SSGetColUserSortIndicator(HWND hWnd, SS_COORD Col);

void SSSetColUserSortIndicator(HWND hWnd, SS_COORD Col, short nColUserSortIndicator);

C++

short TSpread::GetColUserSortIndicator(SS_COORD Col);

void TSpread::SetColUserSortIndicator(SS_COORD Col, short nColUserSortIndicator);

Parameters

The following parameters are available:

Parameter Description
hWnd Window handle of the fpSpread control
Col Column number
nColUserSortIndicator Sort indicator to display and sort method used
Can be one of the following values:
Value Description
0 (Default) No pointer appears
No sorting occurred. The SSM_BEFOREUSERSORT and SSM_AFTERUSERSORT messages are not sent.
Constant: SS_COLUSERSORTINDICATOR_NONE
1 The pointer appears when the column is sorted
Ascending sort occurred. The SSM_BEFOREUSERSORT and SSM_AFTERUSERSORT messages are sent.
Constant: SS_COLUSERSORTINDICATOR_ASCENDING
2 The pointer appears when the column is sorted
Descending sort occurred. SSM_BEFOREUSERSORT and SSM_AFTERUSERSORT messages are sent.
Constant: SS_COLUSERSORTINDICATOR_DESCENDING
3 No pointer appears
No sorting can occur. The SSM_BEFOREUSERSORT and SSM_AFTERUSERSORT messages are not sent.
Constant: SS_COLUSERSORTINDICATOR_DISABLED

Remarks

This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.

By default, when a user clicks a column header, the column is selected. You can allow users to click on column headers to sort the data by that column. When the SSSetUserColAction function's nUserColAction parameter is set to 1 (SS_USERCOLACTION_SORT), the sort indicator (and sort) will toggle as the user clicks a column header.

The sort indicator appears after the data is sorted and appears only in the column by which the data is sorted. For example, assume you can sort the first or second column. If you click the column header of the first column, data is sorted by the first column and the sort indicator appears in the first column header. If you then click the column header of the second column, the data is sorted by the second column and the sort indicator appears in the column header of the second column.

You can also sort the sheet by a specific column using code without any user action. If you set the SSSetColUserSortIndicator function's ColUserSortIndicator parameter to either 1 (SS_COLUSERSORTINDICATOR_ASCENDING) or 2 (SS_COLUSERSORTINDICATOR_DESCENDING) before you set the SSSetUserColAction function's UserColAction parameter to 1 (SS_USERCOLACTION_SORT) or 2 (SS_USERCOLACTION_SORTNOINDICATOR), the Spread control will search from left to right until if finds the first column for which the SSSetColUserSortIndicator function's nColUserSortIndicator parameter is set and sort the sheet automatically based on that indicator. For example, if you set the SSSetColUserSortIndicator function's nColUserSortIndicator parameter for the second column to 1 (SS_COLUSERSORTINDICATOR_ASCENDING) and you set the SSSetUserColAction function's nUserColAction parameter to 1 (SS_USERCOLACTION_SORT), the data will be sorted by the second column automatically in ascending order.

Tip: If you want to sort the sheet based a specific column using code, you should never call the SSSetColUserSortIndicator function for more than one column and you must call the SSSetColUserSortIndicator function before you call the SSSetUserColAction function.

If your sheet displays multiple headers, indicate the column header row in which the sort indicator should appear by calling the SSSetColHeadersUserSortIndex function.

This property does not have an effect if the SSSetUserColAction function's nUserColAction parameter is set to SS_USERCOLACTION_DEFAULT.

Notes:
  • User sorting causes all sheet data to be sorted. It does not occur on a column-by-column basis. In other words, when you click on a column to sort, the data in all the rows moves according to the data in the column on which you are sorting.
  • User sorting will not occur on columns that contain spanned cells.

Return Value

SSGetColUserSortIndicator: Current indicator setting
SSSetColUserSortIndicator: None

See Also

Allowing Users To Sort By Columns

SSSetColHeadersUserSortIndex, SSSetSheet, SSSetUserColAction functions

SSM_AFTERUSERSORT, SSM_BEFOREUSERSORT messages

ActiveX Correspondence

ColUserSortIndicator property

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.