Board index » delphi » D4p2 and QR3.03 Error with own previewer

D4p2 and QR3.03 Error with own previewer

Can someone explain this to me....
Why does my own preview form (+Notebookpage itself) closes when i want to
scroll through it or when i click on one of my toolbarbuttons....... (Not
the exit button!)
In D3 everthything worked nice!!!
The TQRPREVIEW component is placed on a tabbed notebook....
at the main form...
When i come on the preview (Notebook) page for the second time
etherything work ok... but generates a access violation????
when a user closes the application.
Some code.........

unit main
Qrpreview.QReport.preview;
===========
In the onexit event of the TQrPreview object
  QRPreview.QRPrinter := nil;
===========
In unit uReport (Print form) with Header-Detail dbQR fields...
procedure TfmReport.QreportReview(Sender: TObject);
begin
  fmMain.QRPreview.QRPrinter:=TQRPrinter(Sender);
end;

TIA
Frank

 

Re:D4p2 and QR3.03 Error with own previewer


Because of some screwiness in QuickReport, be sure to put something like this in
there:

void TPrintPreview::PrepareReport()
{
  //Use this function to transfer the image on the Report to the preview
  //Due to a QuickReport bug, the try and catch structure is necessary, as is
  //  the Freeing of the QRPrinter pointer.
  try
  {
    if (QuickRep->QRPrinter != NULL && QuickRep->QRPrinter != 0)
    {
      QuickRep->QRPrinter->Free(); //Here is the invalid pointer culprit
      QuickRep->QRPrinter = 0;
    }
  }
  catch (...)
  {
    Application->MessageBox("Update Preview?", "Print Preview",
MB_OK|MB_ICONQUESTION);
  }

  QuickRep->Prepare();

Quote
}

Joshua D. Bush -0-0-0-0-0-0-0-0-0-0-0-0-0-0-0- The Scarlet Pumpkin

Other Threads