I have a stringgrid that has a column that I graph (Yearly).
I insert a new row to the grid, and redo the graph, but the new row does not show.
procedure TForm1.DataCellProcess(Sender: TObject; aCol, aRow: integer; processType: TCellProcessType; var aValue: string);
begin
FormChanged := True;
if ACol = 1 then DrawGraph;
end;
The data is in the form of currency, which I change to number to graph.
It appears at this point the value in the cell is null.
procedure TForm1.DrawGraph;
var
i, j, k: integer;
ModifiedName: string;
begin
i := 0;
Yearly.Clear;
Maximum.Clear;
repeat
Inc(i);
Yearly.AddXY(StrToInt(Data.Cells[0, i]), StrToInt(Copy(stringreplace(Data.Cells[1, i], ',', '', [rfReplaceAll]), 2, Pos('.', stringreplace(Data.Cells[1, i], ',', '', [rfReplaceAll])) - 2)));
until Data.cells[1, i + 1] = '';
i := 2;
repeat
Inc(i);
j := StrToInt(Data.Cells[0, i]);
ModifiedName := stringreplace(Data.Cells[3, i], ',', '', [rfReplaceAll]);
k := StrToInt(Copy(ModifiedName, 2, Pos('.', ModifiedName) - 2));
Maximum.AddXY(j, k);
until Data.cells[3, i + 1] = '';
end;
Is there a way I can update the graph (automatically) to show the newly inserted row?
If I insert a second row, then the previous row shows up in the graph (and so on).
PS. Is there any documentation on stringgrid events? I know that the onprocesscell fires when you ctrl-v into the cell, but I cannot find doc that shows this.
Having this kind of doc for all events would be great.