GridPrinter: More general code in dbgrid sample project.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8641 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2022-12-08 17:56:43 +00:00
parent 2aea816f91
commit 4a596b1041

View File

@ -73,7 +73,7 @@ end;
procedure TForm1.GridPrinter1BeforePrint(Sender: TObject);
begin
BufDataset1.First;
DBGrid1.DataSource.Dataset.First;
end;
procedure TForm1.Button1Click(Sender: TObject);
@ -182,10 +182,10 @@ var
begin
dbGrid := AGrid as TDBGrid;
if dgTitles in dbGrid.Options then
BufDataset1.RecNo := ARow
dbGrid.DataSource.Dataset.RecNo := ARow
// RecNo starts at 1. ARow starts at 1, too, since we display the header row
else
BufDataset1.RecNo := ARow + 1;
dbGrid.Datasource.Dataset.RecNo := ARow + 1;
// We must add 1 to the row index since the header row is hidder here.
end;