Hello
Code:
procedure TForm1.grdGradeColumns5CellButtons0GetEnabledState(Grid: TCustomDBGridEh;
Column: TColumnEh; CellButton: TDBGridCellButtonEh; var ButtonEnabled: Boolean);
begin
ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataLink.ActiveRecord = Grid.Row - 1);
//ButtonEnabled := not Grid.DataSource.DataSet.IsEmpty and (Grid.DataSource.DataSet.RecNo = Grid.Row);
end;
You should use Grid.DataLink.ActiveRecord = Grid.Row - 1 expression to check the current record.
The number of rows in the DBGrid is equal to the number of visible rows.
So when scrolling, RecNo will increase but Grid.Row will not exceed the number of visible rows.