UserColAction Property
Applies To
Spread control
Description
Sets or returns the action to perform when the user clicks a column header.
Syntax
long CSpreadSheet::GetUserColAction( );
void CSpreadSheet::SetUserColAction(long value);
[form.]fpSpread.UserColAction[= setting%]
Remarks
The following settings are available:
Setting | Description | Constant |
---|---|---|
0 - Default | (Default) Column is selected when user clicks the column header. | UserColActionDefault |
1 - Sort | Data is sorted when user clicks the column header. Column sort indicator displays. |
UserColActionSort |
2 - SortNoIndicator | Data is sorted when user clicks the column header. Column sort indicator does not display. |
UserColActionSortNoIndicator |
3 - Auto Size | Column is automatically sized to best fit the data when the user double clicks the column header. | UserColActionAutoSize |
When you set the UserColAction property to either 1(Sort) or 2 (SortNoIndicator) and the user clicks a column header,
- The action toggles between an ascending and descending sort.
- The BeforeUserSort and AfterUserSort events occur.
The user can also click on a column to apply a primary sort and control-click on a second column to apply a secondary sort.
This setting is applied to the current sheet setting unless you first set the Sheet property to specify the sheet for which you are setting the property.
This property does not have an effect if the ColUserSortIndicator property is set to 3 (Disabled).
You can use the ColUserSortIndicator property 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.
You can also sort the sheet by a specific column using code without any user action. If you set the ColUserSortIndicator property in code to either 1 (Ascending) or 2 (Descending) before you set the UserColAction property to 1 (Sort) or 2 (SortNoIndicator), the Spread control will search from left to right until it finds the first column for which the ColUserSortIndicator property is set and sort the sheet automatically based on that indicator. For example, if you set the ColUserSortIndicator property for the second column to 1 (Ascending) and you set the UserColAction property to 1 (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 set the ColUserSortIndicator property for more than one column and you must set the ColUserSortIndicator property before you set the UserColAction property. |
Spread Designer
Choose the Sheet menu, then the Columns and Rows menu, select the Columns tab, and then select an item in the Header Action drop-down list box in the Settings-All Columns group box in the Column and Row Settings dialog box.
Data Type
Integer (Enumerated)
See Also
Allowing Users To Sort By Columns
ColHeadersUsersSortIndex, ColUserSortIndicator, Sheet properties
AfterUseSort, BeforeUserSort events
DLL Correspondence
SSGetUserColAction, SSSetUserColAction functions