Author: Tomas Rutkauskas
Is there a method to insert a row into a StringGrid or do I have to shuffle all
higher rows up 1?
Answer:
TCustomGrid has a very useful but unfortunately protected method named MoveRow. You
can get at it using the cracker class strategy:
1 type2 TGridCracker = class(TCustomGrid);
3 4 {insert a line at row 5}5 stringgrid1.rowcount := stringgrid1.rowcount + 1;
6 TGridCracker(stringgrid1).Moverow(stringgrid1.rowcount - 1, 5);
You first add a new empty line, then move it to the required position. This automatically moves all following lines one position down.