Spread 8.0 Documentation
SSGetUserColAction, SSSetUserColAction Functions
Support Options
DLL Reference > DLL Functions > SSGetUserColAction, SSSetUserColAction Functions

Glossary Item Box

SSGetUserColAction, SSSetUserColAction Functions


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Set or return the action to perform when the user clicks a column header.

Syntax

C

short SSGetUserColAction(HWND

hWnd);

void SSSetUserColAction(HWND hWnd, short nUserColAction);

C++

short TSpread::GetUserColAction( );

void TSpread::SetUserColAction(short nUserColAction);

Parameters

The SSGetUserColAction function has the following parameter:

Parameter Description
hWnd Window handle of the fpSpread control

The SSSetUserColAction function has the following parameters:

Parameter Description
hWnd Window handle of the fpSpread control
nUserColAction Specifies the action to perform
Use one of the following values:
Description
(Default) Column is selected when user clicks the column header.
Constant: SS_USERCOLACTION_DEFAULT
Data is sorted when user clicks the column header.
Column sort indicator appears.
Constant: SS_USERCOLACTION_SORT
Data is sorted when user clicks the column header.
Column sort indicator does not appear.
Constant: SS_USERCOLACTION_SORTNOINDICATOR

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.

You can call the SSSetColUserSortIndicator function to determine if sorting occurred and which sort indicator is displayed. The sort indicator (and sort) will toggle as the user clicks a column header.

When you call the SSSetUserColAction function to either 1 (SS_USERCOLACTION_SORT) or 2 (SS_USERCOLACTION_SORTNOINDICATOR) and the user clicks a column header,

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.

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.

This functions does not have an effect if the SSSetColUserSortIndicator function's ColUserSortIndcator parameter is set to SS_COLUSERSORTINDICATOR_DISABLED.

Return Value

SSGetUserColAction: Current value of the nUserColAction parameter
SSSetUserColAction: None

See Also

Allowing Users To Sort By Columns

SSSetColUserSortIndicator, SSSetSheet functions

SSM_BEFOREUSERSORT, SSM_AFTERUSERSORT messages

ActiveX Correspondence

UserColAction property

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