--- El vie 13-may-11, Juha (gmail) <juha.mannine...@gmail.com> escribió:
> De: Juha (gmail) <juha.mannine...@gmail.com> > Asunto: Re: [Lazarus] Sorting StringGrid by column click > A: "Lazarus mailing list" <lazarus@lists.lazarus.freepascal.org> > Fecha: viernes, 13 de mayo de 2011, 5:46 > 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'm sorry this patch must be reverted, there is no reason to send SortOrder as parameter when SortOrder is a grid's public property. And as you said it unnecessarily breaks code, for example semaphore grid which is included with Lazarus which by the way has exteneded sorting capabilities. > 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). I'm sorry I still have to review the code been too busy lately, but I was thinking that maybe we don't need default icons for ordering direction, first we need to check if the lcl do not use some similar resources, if it doesn't, I think as a default we could just draw it ourselves. > > Juha > Jesus Reyes A. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus