If you shop at Amazon anyway, consider using this
link. We receive a few cents from each purchase. Thanks.
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
Send an e-mail with your
comments about this program (or anything else).
Here's some demo code showing how to move a row up or down the grid based on
Moving the row requires a temporary TStringlist to hold a row while it is
being replaced. There are two versions of the MoveGridRow procedure, one
receiving a pre-allocated Temp string list as part of the calling
parameters, another which allocates the string list, moves the rows, and then
frees the list. The timing buttons compare times for the two methods and seem to
indicate that pre-allocating has very little (or negative) speed-up effect. The
2nd timing button hides the grid while moving and shows that redrawing the grid
uses much more time than actual row move time.
A viewer had requested the ability to carry a hidden "record number" along with
each row. I implemented this using the "Objects" property for cell 0 of each row
to hold an integer. Test numbers were generated as 10x the original row number.
To verify that object data was moved with the rows, Gordon's button lists
the record numbers after the rows have been rearranged.
Download source code
|Created: August 23, 2010
August 23, 2010