GtkCList::sort
Sorts the GtkClist according to the settings of
sort column
and
sort type.
The sort function knows to distinguish between
normal text
and
pixtext,
so that a mixture of normal and pixtext will be sorted right.
The items are handled as text when being compared, so numbers will
be not in a "natural" order.
Here is an example how to let the user sort the list by columns when
he clicks on a column title. The sort order (type) is changed everytime he clicks
on the same column title.
Example 8. Sorting GtkCList rows by clicking the title
function sortList( $objList, $nColumn)
{
if( $nColumn != $objList->sort_column ) {
$objList->set_sort_column( $nColumn);
$objList->set_sort_type( GTK_SORT_ASCENDING);
} else {
if( $objList->sort_type == GTK_SORT_ASCENDING) {
$objList->set_sort_type( GTK_SORT_DESCENDING);
} else {
$objList->set_sort_type( GTK_SORT_ASCENDING);
}
}
$objList->sort();
}
$objList->connect( 'click-column', 'sortList');
|