View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037794 | Lazarus | LazReport | public | 2020-09-22 09:59 | 2020-09-30 11:25 |
Reporter | Zdravko Gabrovski | Assigned To | Jesus Reyes | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | all | OS | all | ||
Product Version | 2.1 (SVN) | ||||
Fixed in Version | 2.1 (SVN) | ||||
Summary | 0037794: New "Onbeforepreview" event in LazReport | ||||
Description | In the current version of LazReport, the developer has no control over the standard "Preview report" form. In my case I am developing a plugin dll library, which uses lazrRepor in DLL as a non-modal form. I need to set form style of the standard preview form to "fsStayOnTop" and register the form in object list, that I will use later on to free the form objects (as it is known, it is not possible to set action=caFree in non modal form in dll, it raises AV). To solve all the cases, I just add a new event handler called "OnBeforePreview" in LazReport. It will pass by reference already created preview form, which will give an option to developer to modify it. New Event Hadler type: TBeforePreviewFormEvent = procedure( var PrForm : TfrPreviewForm ) of Object; Nee variable: fOnBeforePreview : TBeforePreviewFormEvent; And new property: property OnBeforePreview : TBeforePreviewFormEvent read fOnBeforePreview write fOnBeforePreview; And small modification in procedure TfrReport.ShowPreparedReport: if Assigned( OnBeforePreview ) then OnBeforePreview( p ); and a sample of usage in my code: procedure TDataModule2.frReport1BeforePreview(var PrForm: TfrPreviewForm); begin PrForm.FormStyle := fsStayOnTop; // Changle preview form style; In DLL if it if fsNormal, the user can hide the form PrForm.OnClose := @FormCloseHandler; // I am using this to add a form object to object list for free the non-modal forms created in dll end; | ||||
Steps To Reproduce | Enhancement | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 63938 | ||||
LazTarget | 2.2 | ||||
Widgetset | |||||
Attached Files |
|
|
lr_class.diff (1,683 bytes)
Index: components/lazreport/source/lr_class.pas =================================================================== --- components/lazreport/source/lr_class.pas (revision 63906) +++ components/lazreport/source/lr_class.pas (working copy) @@ -140,6 +140,7 @@ TPrintReportEvent = procedure(Sender: TfrReport) of object; TFormPageBookmarksEvent = procedure(Sender: TfrReport; Backup: boolean) of object; TExecScriptEvent = procedure(frObject:TfrObject; AScript:TfrScriptStrings) of object; + TBeforePreviewFormEvent = procedure( var PrForm : TfrPreviewForm ) of Object; TfrHighlightAttr = packed record FontStyle: Word; @@ -1148,6 +1149,7 @@ FObjectClick: TObjectClickEvent; FOnExportFilterSetup: TExportFilterSetup; fOnFormPageBookmarks: TFormPageBookmarksEvent; + fOnBeforePreview : TBeforePreviewFormEvent; FPages: TfrPages; FEMFPages: TfrEMFPages; FRebuildPrinter: boolean; @@ -1364,6 +1366,7 @@ property OnObjectClick: TObjectClickEvent read FObjectClick write FObjectClick; property OnMouseOverObject: TMouseOverObjectEvent read FMouseOverObject write FMouseOverObject; property OnFormPageBookmarks: TFormPageBookmarksEvent read fOnFormPageBookmarks write fOnFormPageBookmarks; + property OnBeforePreview : TBeforePreviewFormEvent read fOnBeforePreview write fOnBeforePreview; end; TfrCompositeReport = class(TfrReport) @@ -11509,6 +11512,8 @@ p.SaveDialog.InitialDir := ExtractFilePath(ExportFileName); p.SaveDialog.FileName := ExportFilename; end; + if Assigned( OnBeforePreview ) then + OnBeforePreview( p ); p.Show_Modal(Self); end; {$IFDEF DebugLR} |
|
Shouldn't this be triggered also in case of custom preview form? |
|
I think no - in a custom preview form the developer has full control over it. the problem in my case is with standard preview form. |
|
Thanks, Applied. |
|
Thanks! |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-09-22 09:59 | Zdravko Gabrovski | New Issue | |
2020-09-22 09:59 | Zdravko Gabrovski | File Added: lr_class.diff | |
2020-09-24 09:12 | Jesus Reyes | Assigned To | => Jesus Reyes |
2020-09-24 09:12 | Jesus Reyes | Status | new => assigned |
2020-09-24 09:43 | Jesus Reyes | Status | assigned => feedback |
2020-09-24 09:43 | Jesus Reyes | LazTarget | => - |
2020-09-24 09:43 | Jesus Reyes | Note Added: 0125806 | |
2020-09-24 11:18 | Zdravko Gabrovski | Note Added: 0125811 | |
2020-09-24 11:18 | Zdravko Gabrovski | Status | feedback => assigned |
2020-09-29 07:37 | Jesus Reyes | Status | assigned => resolved |
2020-09-29 07:37 | Jesus Reyes | Resolution | open => fixed |
2020-09-29 07:37 | Jesus Reyes | Fixed in Version | => 2.1 (SVN) |
2020-09-29 07:37 | Jesus Reyes | Fixed in Revision | => 63938 |
2020-09-29 07:37 | Jesus Reyes | LazTarget | - => 2.2 |
2020-09-29 07:37 | Jesus Reyes | Note Added: 0125951 | |
2020-09-30 11:25 | Zdravko Gabrovski | Status | resolved => closed |
2020-09-30 11:25 | Zdravko Gabrovski | Note Added: 0125981 |