Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## on-sort-predicate

Arguments: standard-object

Returns or sets with setf the value of the on-sort-predicate event-handler property of a `dialog-item`. The value may be a function name or function object, which determines the ordering of items in a `list-view-column`, `grid-column`, or `outline` control. The value may also be `nil` to indicate that the control is not sortable (using its built-in sorting functionality). When the value is a function, the function should accept two arguments and return true when the first value should precede the second (as with the predicate argument to cl:sort).

For a `list-view-column`, where the sorted values are always strings, the default value is string-lessp (for a case-insensitive alphanumeric sort). For a `grid-column` or `outline`, the default is `nil` because the sortable values are arbitrary Lisp objects, and so there is no possible general default predicate that would not cons strings in many cases. For these objects, a custom on-sort-predicate must be supplied in order to use the built-in sorting behavior.

The on-sort-predicate function (if any) is used when calling sort-grid on a `grid-widget`, when calling add-outline-item-value (without an explicit position argument) or replace-outline-item-value on an `outline` control, when calling list-view-sort, (setf sort-column) or (setf sort-reverse) on a `list-view` control (which happens internally when clicking a `list-view` column header).

See cg-events.htm for information about event handling in Common Graphics.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version