12-21-2021, 11:56 AM
Property grdContent.ScrollToCurrentRow = True.
After clicking on the "Fill Grid" button, grid is filled with 50 rows and CurrentRow is set to 40.
But it keeps showing the top of the grid.
I have tried it sync and async, but result stays the same.
procedure TIWForm1.btnClearGridAsyncClick(Sender: TObject;
EventParams: TStringList);
begin
grdContent.Clear;
end;
procedure TIWForm1.btnFillGridAsyncClick(Sender: TObject;
EventParams: TStringList);
begin
FillContentGrid(40);
end;
procedure TIWForm1.FillContentGrid(ActiveRow: Integer);
var
r, c: Integer;
begin
grdContent.Clear;
grdContent.ColumnCount := 5;
grdContent.RowCount := 50;
For r := 0 To 49 Do
Begin
For c := 0 To 4 Do
Begin
grdContent.Cell[r, c].Text := 'Cell(' + IntToStr® + ',' + IntToStr© + ')';
End;
End;
grdContent.CurrentRow := ActiveRow;
grdContent.ScrollToCurrentRow := True;
end;
After clicking on the "Fill Grid" button, grid is filled with 50 rows and CurrentRow is set to 40.
But it keeps showing the top of the grid.
I have tried it sync and async, but result stays the same.
procedure TIWForm1.btnClearGridAsyncClick(Sender: TObject;
EventParams: TStringList);
begin
grdContent.Clear;
end;
procedure TIWForm1.btnFillGridAsyncClick(Sender: TObject;
EventParams: TStringList);
begin
FillContentGrid(40);
end;
procedure TIWForm1.FillContentGrid(ActiveRow: Integer);
var
r, c: Integer;
begin
grdContent.Clear;
grdContent.ColumnCount := 5;
grdContent.RowCount := 50;
For r := 0 To 49 Do
Begin
For c := 0 To 4 Do
Begin
grdContent.Cell[r, c].Text := 'Cell(' + IntToStr® + ',' + IntToStr© + ')';
End;
End;
grdContent.CurrentRow := ActiveRow;
grdContent.ScrollToCurrentRow := True;
end;