Jesus Reyes kirjoitti torstai, 12. toukokuuta 2011 22:33:50: > Just let's not forget that this is a generic *string* grid, why users > should expect it to sort numbers when the grid is specifically made to > hold strings?
Yes. If some columns could be defined to hold numbers and then sorted accordingly, should we implement validity and integrity checks, too? We would basically create a database. > Appart from strings, the grid already supports Custom Sorting, so it can > sort any way the user wants, even numbers. Just write an handler for > OnCompareCells, this is even documented: > http://wiki.lazarus.freepascal.org/Grids_Reference_Page#Sorting_Columns_or > _Rows Yes and Custom Sorting can be used also when automatic column sorting is enabled through ColumnClickSorts property. I realized SortOrder support for custom sorting is now important because column clicking automatically switches SortOrder. I added the parameter to TOnCompareCells. It breaks old code but the fix is easy and there is no Delphi compat issue because Delphi doesn't have such event. I will return to Alexander's ideas of sort images later. The current code however is usable in every use case, including numeric custom sort and also user defined sort glyps (by not enabling ColumnClickSorts). Juha -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
