Juha (gmail) kirjoitti perjantai, 13. toukokuuta 2011 13:46:08: > 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.
And now I realized the result could be negated based on SortOrder after calling OnCompareCells instead of letting the user take care of it, like this: function TCustomGrid.DoCompareCells(Acol, ARow, Bcol, BRow: Integer): Integer; begin result := 0; if Assigned(OnCompareCells) then begin OnCompareCells(Self, ACol, ARow, BCol, BRow, FSortOrder, Result); if SortOrder=soDescending then result:=-result; end; end; 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 -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus