[Lazarus] Sorting StringGrid by column click

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat May 14 00:21:12 CEST 2011


Jesus Reyes schrieb:

>> Which way is better? I think the Descending-sort code is always
>> identical: if SortOrder=soDescending then result:=-result; and it
>> could be better if users don't need to worry about it.
>> 
>> Juha
> 
> 
> At first sight it seems to be a good idea however by doing this, we
> couldn't say the grid support "custom" sorting but "limited custom"
> sorting capabilities, because it's based on the interpretation of the
> SortOrder property.
> 
> Because how would one sort multiple columns with different Sorting
> orders, for example one column sorting alphabetically in ascending
> order while at the same time another column, say a rate column, in
> descending order, the same for dates, numbers, etc.

That's the task of OnCompareCells. Ascending/Descending only reverts the 
row order of the entire grid.

DoDi





More information about the Lazarus mailing list