--- El vie 13-may-11, Juha (gmail) <[email protected]> escribió:
> > 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 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. Jesus Reyes A. -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
