LazReport: Add OnFinalSetup event in TFrPrintGrid, patch from Zdravko Gabrovski, issue #37021

git-svn-id: trunk@63182 -
This commit is contained in:
jesus 2020-05-18 11:31:49 +00:00
parent ac6b80f0c2
commit 9cdfd55ed4

View File

@ -32,9 +32,14 @@ type
ColumnWidth: Integer;
end;
TColumnInfoArr = Array of TColumnInfo;
TSetupColumnEvent=procedure(Sender:TFrPrintGrid; const Column: TColumn;
var PrintColumn:boolean; var ColumnWidth:Integer) of object;
TFinalSetupEvent=procedure(Sender:TFrPrintGrid; var FReport : TfrReport;
var FColumnsInfo : TColumnInfoArr ) of object;
{ TfrPrintGrid }
TfrPrintGrid = class(TComponent)
@ -42,6 +47,7 @@ type
FDBGrid : TCustomDBGrid;
FOnGetValue: TDetailEvent;
FOnSetUpColumn: TSetupColumnEvent;
FOnFinalSetup : TFinalSetupEvent;
FPrinterIndex : Integer;
FReport : TfrReport;
FReportDataSet : TfrDBDataSet;
@ -53,7 +59,7 @@ type
FCaption : String;
FShowCaption : Boolean;
FDataSet : TDataset;
FColumnsInfo : array of TColumnInfo;
FColumnsInfo : TColumnInfoArr;
FTemplate : string;
procedure OnEnterRect(Memo: TStringList; View: TfrView);
@ -86,6 +92,8 @@ type
property ShowProgress : Boolean read fShowProgress write fShowProgress default false;
property OnSetupColumn: TSetupColumnEvent read FOnSetUpColumn write FOnSetupColumn;
property OnGetValue: TDetailEvent read FOnGetValue write FOnGetValue;
property OnFinalSetup: TFinalSetupEvent read FOnFinalSetup write FOnFinalSetup;
end;
@ -371,6 +379,9 @@ begin
FReport.PrepareReport;
end;
if Assigned( OnFinalSetup ) then
OnFinalSetup( Self, FReport, FColumnsInfo );
FReport.ShowReport;
finally
FDataSet.GotoBookmark(BM);