[DUG] Stringgrids
John Bird
johnkbird at paradise.net.nz
Fri Feb 2 11:02:33 NZDT 2007
Do you mean to sort by row or column? I am guessing if you are swapping
rows you are sorting by a column
I have written a general routine to sort any stringgrid by any two
specified columns, ascending or descending. I would be happy to post it if
interested.
I do it by using a temporary Tstringlist and dynamic array to load the
column values and original indexes into and then doing an alpha sort after.
It caters for a couple of data types, not just alpha sorting, so could
easily be extended to sort on various data types. I think this way is
faster especially with bigger grids.
The only tricky issues were dealing with fixed rows/columns and whether to
keep the current row value after the sort.
John
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Eion McIntosh (Christchurch)
Sent: Friday, 2 February 2007 9:07 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Stringgrids
Hi
I havd a look, but can't see anything, but can you take 2 rows within a
TStringGrid and swap them? I have some details in a stringgrid but would
like to sort it on one of the rows after it has been filled. I can't fill it
in order to start with because the source data is coming from two different
sources.
Regards
Eion McIntosh
PPCS Ltd
__________ NOD32 1.1461 (20060329) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20070202/66522bee/attachment-0001.html
More information about the Delphi
mailing list