Hi dear friends, I strongly recommend to add the follow procedure in the class TStringGrid. It has helped me a lot. It's simple and very useful.
procedure StringGridInsertRow(StringGrid: TStringGrid; Index: Integer; Values: array of String);
var
i1, i2: Integer;
begin
if (Index < StringGrid.FixedRows) or (Index > StringGrid.RowCount) then
raise Exception.Create('Index out of bounds.');
StringGrid.RowCount := StringGrid.RowCount +1;
for i1 := StringGrid.RowCount -1 downto Index +1 do
for i2 := 0 to StringGrid.ColCount -1 do
StringGrid.Cells[i2, i1] := StringGrid.Cells[i2, i1 -1];
for i2 := 0 to StringGrid.ColCount -1 do
StringGrid.Cells[i2, Index] := Values[i2];
end;
I don't know who does or where is supposed to put that kind of contribution, so I've done here.
I hope is right.