Skip to main content

OnStartGenerateReport, OnEndGenerateReport, OnGenerateReportProgress Example

The following example demonstrates organization of the indicator that appears when building a report as an independent form. This form contains only one control – TProgressBar, has no border icons, and its border style is equal to bsDialog. Indicator form is created on starting report generation and is closed when the report has been generated.

// Creates a form with a progress indicator
procedure TForm1.dxComponentPrinter1StartGenerateReport(Sender: TObject;  AReportLink: TBasedxReportLink);
begin
  Form2 := TForm2.Create(Application);
  Form2.Show;
end;
// Sets the indicator's value according to the report generation process
procedure TForm1.dxComponentPrinter1GenerateReportProgress(Sender: TObject; AReportLink: TBasedxReportLink; APercentDone: Double);
begin
  Form2.ProgressBar1.Position := Round(APercentDone);
  Form2.Repaint;
end;
// Closes the form containing the progress indicator
procedure TForm1.dxComponentPrinter1EndGenerateReport(Sender: TObject; AReportLink: TBasedxReportLink);
begin
  Form2.Close;
end;