Report loaded from template not firing tppReport.preview form events
Please consider this code:
procedure TExRptExecute.ReportPreviewFormCreate(Sender: TObject);
begin
with (Sender as TppReport) do
PreviewForm.BorderIcons := [biSystemMenu];
end;
Procedure TExRptExecute.RunReport(Const ReportFile: String);
Begin;
If FileExists(ReportFile) then begin
Report.Template.FileName := ReportFile;
Report.Template.Load;
Report.PrintReport;
End;
End;
The PreviewFormCreate is correctly assigned to the event but never
gets fired after Report.PrintReport;
I also tried this:
procedure TExRptExecute.ReportAssignPreviewFormSettings(Sender:
TObject);
begin
with (Sender as TppReport) do
PreviewForm.BorderIcons := [biSystemMenu];
end;
Still does not work.
Is this a bug or am I doing somthing wrong. I need to disable the
minimize button on the preview form.
Using Delphi 2007 with ReportBuilder 10.8.
Thanks,
J. Michael Eubanks
--
procedure TExRptExecute.ReportPreviewFormCreate(Sender: TObject);
begin
with (Sender as TppReport) do
PreviewForm.BorderIcons := [biSystemMenu];
end;
Procedure TExRptExecute.RunReport(Const ReportFile: String);
Begin;
If FileExists(ReportFile) then begin
Report.Template.FileName := ReportFile;
Report.Template.Load;
Report.PrintReport;
End;
End;
The PreviewFormCreate is correctly assigned to the event but never
gets fired after Report.PrintReport;
I also tried this:
procedure TExRptExecute.ReportAssignPreviewFormSettings(Sender:
TObject);
begin
with (Sender as TppReport) do
PreviewForm.BorderIcons := [biSystemMenu];
end;
Still does not work.
Is this a bug or am I doing somthing wrong. I need to disable the
minimize button on the preview form.
Using Delphi 2007 with ReportBuilder 10.8.
Thanks,
J. Michael Eubanks
--
This discussion has been closed.
Comments
Well.. it seems that the event must be reassigend after the
template.load method, like this:
Procedure TExRptExecute.RunReport(Const ReportFile: String);
Begin;
If FileExists(ReportFile) then begin
Report.Template.FileName := ReportFile;
Report.Template.Load;
report.OnPreviewFormCreate := ReportPreviewFormCreate;
Report.PrintReport;
End;
The event is correctly assigned at designtime.
Michael
--
template.
When you save the template, if you save it as ASCII, you will see it in the
report file.
Ed Dressel