Closing the Preview from code

BJLBJL Brussels, Belgium
edited 12:13AM in FastReport 3.0
Working with BCB6 and FR3

With FR version 2, I have been using successfully the following code to close the preview and allow a new one with a different dataset
void __fastcall TDMenu::ClosePreView(void)
{
  for (int i = frReport1->ComponentCount - 1; i >= 0; i--)
  {
    if (dynamic_cast<TfrPreviewForm*>(frReport1->Components[i]))
    {
      dynamic_cast<TForm*>(frReport1->Components[i])->Hide();
      dynamic_cast<TForm*>(frReport1->Components[i])->Close();
    }
  }
}

However, in FR version 3, TfrxPreviewForm is not accepted as a type.
What is the equivalent in version 3 of TfrPreviewForm of the version 2?

Is there a better way to close the preview?

Comments

  • edited 12:13AM
    To use TfrxPreviewForm include frxPreview.hpp header.
  • BJLBJL Brussels, Belgium
    edited 12:13AM
    Den,

    I did include the hpp file. However the code did not work because the preview is not (no more) within the list of compnents.

    BJL
  • edited 12:13AM
    In Delphi code I use

    TForm(frxDmxUse.Preview.Parent).Close;

    in the OnAfterPrintReport event

    Peter
    Technisoft
  • edited 12:13AM
    frxReport1->PreviewForm->Hide();
    frxReport1->PreviewForm->Close();

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.