Spread 8.0 Documentation
ColUserSortIndicator Property
Support Options
ActiveX Reference > ActiveX Properties > ColUserSortIndicator Property

Glossary Item Box

ColUserSortIndicator Property


See Also    DLL    Example

Applies To

fpSpread control

Description

Sets or returns the sort indicator to display. This property is available at run time only.

Syntax

C++

long CSpreadSheet::GetColUserSortIndicator(long lCol);
void CSpreadSheet::SetColUserSortIndicator(long lCol, long NewValue);

Visual Basic

[form.]fpSpread.ColUserSortIndicator(lCol As Long)[= setting%]

Remarks

The following settings are available:

Setting Description Constant
0 - None (Default) No pointer appears
No sorting occurred. The BeforeUserSort and AfterUserSort events did not occur.
ColUserSortIndicatorNone
1 - Ascending The pointer appears when the column is sorted
Ascending sort occurred. The BeforeUserSort and AfterUserSort events occurred.
ColUserSortIndicatorAscending
2 - Descending The pointer appears when the column is sorted
Descending sort occurred. The BeforeUserSort and AfterUserSort events occurred.
ColUserSortIndicatorDescending
3 - Disabled No pointer appears
No sorting can occur. The BeforeUserSort and AfterUserSort events did not occur.
ColUserSortIndicatorDisabled

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 UserColAction property is set to 1 (Sort), the sort indicator (and sort) will toggle as the user clicks a column header. 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.

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 on 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 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 if 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.

If your sheet displays multiple headers, indicate the column header row in which the sort indicator should appear by setting the ColHeadersUserSortIndex property.

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 UserColAction property is set to 0 (Default).

Notes:
  • User sorting causes all data in the sheet 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.

Spread Designer

Choose the Sheet menu, then the Columns and Rows menu, select the Columns tab, and then select an item in the Sort Indicator drop-down list box in the Settings-Current Column group box in the Column and Row Settings dialog box.

Before setting the Sort Indicator, select the column for which you want to display the sort indicator.

Data Type

Integer (Enumerated)

See Also

Allowing Users To Sort By Columns

ColHeadersUserSortIndex, Sheet, UserColAction properties

AfterUserSort, BeforeUserSort events

DLL Correspondence

SSGetColUserSortIndicator, SSSetColUserSortIndicator functions

Copyright © GrapeCity, inc. All rights reserved.