Exception when previewing report from designer
I am using FastReport 3.2.21 in Delphi 2006. I have a custom preview window with a TfrxPreview component connected to a TfrxReport. If I open the designer by calling TfrxReport.DesignReport and press the preview button from within the designer I get an exception whenever the custom preview window is redrawn. You can easily see this error in the frDemo program if you change frxReport1.PreviewOptions.Modal to false.
First press the Preview button and resize the preview window so you can see the main window. Next press the Design button and resize the designer so you can see the preview window. Next press the preview button in the designer and resize the designers preview window so the original preview window is visible. You will get an EAccessViolation exception on line 618 of frxPreview.pas any time the original preview window is redrawn by windows. The PreviewPages function call returns a nil pointer.
I assumed from this behavior that the TfrxReport component can only handle one preview at a time. So I tried setting the custom preview component's Report property to nil and setting the reports Preview property to nil before opening the designer window. I still get the exception. To get this to work I finally had to creat a second report component and copy the report via a stream to be able to open the designer with out fear of an exception.
Is there a better way to preview a report from the designer when the report component already has a preview window opened? I suspect that my work around makes inefficient use of memory and processor cycles.
First press the Preview button and resize the preview window so you can see the main window. Next press the Design button and resize the designer so you can see the preview window. Next press the preview button in the designer and resize the designers preview window so the original preview window is visible. You will get an EAccessViolation exception on line 618 of frxPreview.pas any time the original preview window is redrawn by windows. The PreviewPages function call returns a nil pointer.
I assumed from this behavior that the TfrxReport component can only handle one preview at a time. So I tried setting the custom preview component's Report property to nil and setting the reports Preview property to nil before opening the designer window. I still get the exception. To get this to work I finally had to creat a second report component and copy the report via a stream to be able to open the designer with out fear of an exception.
Is there a better way to preview a report from the designer when the report component already has a preview window opened? I suspect that my work around makes inefficient use of memory and processor cycles.