Programming Guide



sm_obj_sort_auto

Sorts the object's occurrences according to grid conventions

int sm_obj_sort_auto(int obj_id);

obj_id
An integer handle that identifies the object to be sorted. For widgets, it can be obtained from sm_prop_id.

Returns

Description

sm_obj_sort_auto sorts the object's occurrences according to the rules specified for grids in the Windows API. For fields that have their Column Click Action property set to PV_SORT, this function is invoked automatically in response to user clicks on the field's grid column heading.

What happens in response to the invocation of sm_obj_sort_auto on a given field depends on the settings of the field's runtime properties column_arrow_direction and column_arrow_hidden.

If column_arrow_hidden is set to PV_NO, the value of column_arrow_direction will be flipped from PV_UP to PV_DOWN, or vice versa, and the object will be sorted according to the new column_arrow_direction value.

If column_arrow_hidden is set to PV_YES, then the field is sorted according to the current value of column_arrow_direction, and then the value of column_arrow_hidden is changed to PV_NO.

Note that these column arrow properties are in effect, and are manipulated by sm_obj_sort_auto, even when an object is not in a grid and when there is no visible representation of the arrow on the screen.

Access to sm_obj_sort_auto is provided if you want to invoke it in the context of custom column_click_func functions. sm_obj_sort_auto should either be called in response to column click events or during screen entry processing, so that the first time a user sees a grid, it is already sorted. In general, sm_obj_sort_auto is not useful except for objects in grids. For general-purpose sorting of objects and synchronization groups, use sm_obj_sort.

See Also

sm_obj_sort