From 35be9c362178a6d0bf736c86fb5cbe988249b1df Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 10 Oct 2008 00:41:03 +0000 Subject: [PATCH] Fix bug #783 AV after while inserting record --- source/childwin.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/childwin.pas b/source/childwin.pas index 2411f058..010c20b8 100644 --- a/source/childwin.pas +++ b/source/childwin.pas @@ -6180,6 +6180,9 @@ procedure TMDIChild.DataGridInsertRow; var i, j: Integer; begin + // Scroll to the bottom to ensure we append the new row at the very last FDataGridResult chunk + DataGrid.FocusedNode := DataGrid.GetLast; + DataGrid.Repaint; i := Length(FDataGridResult.Rows); SetLength(FDataGridResult.Rows, i+1); SetLength(FDataGridResult.Rows[i].Cells, Length(FDataGridResult.Columns)); @@ -6187,8 +6190,7 @@ begin for j := 0 to Length(FDataGridResult.Rows[i].Cells) - 1 do begin FDataGridResult.Rows[i].Cells[j].Text := ''; end; - DataGrid.AddChild(nil); - DataGrid.FocusedNode := DataGrid.GetLast; + DataGrid.FocusedNode := DataGrid.AddChild(nil); DataGrid.ClearSelection; DataGrid.Selected[DataGrid.FocusedNode] := True; DataGridHasChanges := True;