On Tue, 10 Jun 2003 13:41:46 +1200, you wrote: >Hi All > >I'm trying to give my users the ability to display (and print) previously >run and saved Quick Reports (ie .QRP files). > >I must admit that (among other things) the structure of QuickReports >has been a considerable mystery to me. > >I have managed to get a Preview screen loaded with a saved report and >displayed. I can resize and navigate the pages of the report OK but >when I close the Preview I get an AV.
From memory (I haven't used QR much in the last 3 years)... There were known bugs causing AV's in early releases of QR in the preview when using the close button while the preview was generating. Ensure you are running the latest QR version for your Delphi release (www.qusoft.com). The QR Preview is partially generated via an asynchronous thread. Simply destroying chunks of it while it is populating the preview will also cause AV's. I don't recall the details, but I think there is a protocol of calling a Method (or setting a variable) to terminate the background Preview generation, followed by waiting for a state change (the background thread finishing) before you do the destroy/free. Again I'm sure there are example on the QR site that show the approved mechanism. > >I'd appreciate some help. It must be something to do with not properly >freeing something. > >Below is what I have done. > > > >I have created a PreviewFm form and placed a TQuickRep component >(QR1) on this form. The AfterPreview event contains just a "Close" >statement. > >In my app I have the following procedure: > >procedure HandleViewReportsClick; //mh 2003-06-10 >begin > MainForm.OpenDialog.Filter := 'Report Files, *.qrp|*.QRP'; > MainForm.OpenDialog.Title := 'Select file to view'; > MainForm.OpenDialog.InitialDir := >ExtractFileDir(Application.ExeName); > > if MainForm.OpenDialog.Execute then try > Application.CreateForm(TPreviewFm, PreviewFm); > PreviewFm.QR1.Prepare; > try > PreviewFm.QR1.QRPrinter.Load(MainForm.OpenDialog.FileName); > PreviewFm.QR1.QRPrinter.Preview; > finally > PreviewFm.QR1.Free; > end; > finally > PreviewFm.free; > end >end; > >Any help greatly appreciated > >Mark > >--------------------------------------------------------------------------- > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz >To UnSub, send email to: [EMAIL PROTECTED] >with body of "unsubscribe delphi" >Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ -- Please remove '_SpamTrap' when replying. You know why :-( Peter Ingham Lower Hutt New Zealand --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
