Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Pagination Problem with Preview Form as fsMDIChild

edited August 2007 in General
Delphi 5 / ReportBuilder 6.03 Standard application

Using the following code:

Self.rptMain.ModalPreview := False;

with Self.rptMain.PreviewForm do begin
Caption := 'Transfer Report - Print Preview';
FormStyle := fsMDIChild;
WindowState := wsMaximized;
TppViewer(Viewer).ZoomSetting := zs100Percent;
end;

Report displays in a maximized MDI child preview window. The problem is
when we click the "Next" button, the preview does not scroll to the next
page, and the system hangs with the message in the status bar of
"Calculating page 0 for report Report"

Any help would be greatly appreciated...

Comments

  • edited August 2007
    Hi Bobby,

    Are you able to successfully run the MDI demo located in the
    \RBuilder\Demos\MDI directory? I would suggest using this example as a
    starting point to creating your own MDI applications.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Nico,

    I do not have the MDI sub-directory off \Rbuilder\Demos that you mention
    below. I show:

    1. Reports

    2. AutoSearch

    3. RCL

    4. DLL

    Also, when we set "Self.rptMain.ModalPreview := True", the preview form
    paginates and scrolls the pages properly. The problem occurs when we set
    "Self.rptMain.ModalPreview := False". Why is this?

    Any other thoughts or direction?

  • edited August 2007
    Hi Bobby,

    As a test, try downloading a trial copy of RB 7.04 and test your appliction
    with that. If this does not fix the issue, please provide me with a small
    example or steps I can take to reproduce this behavior on my machine and
    I'll test it for you. Send all attachments to
    support@digital-metaphors.com.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Hi Nico,

    We can download and try RB 7.04. In the meantime, could you test the sample
    code I outlined at the bottom of this post?

    Let us know why the ModalPreview property has to be set to "True" in order
    for a multi-page report to page properly when clicking the navigation
    buttons on the preview form?


  • edited August 2007
    Hi Bobby,

    Sorry for the delay,

    Below is a excerpt from our MDI example showing how to load the preview
    successfully. Note the need to set the OnClose event to nil and to call
    TppCustomPreview.Init. This should get you on the right track.

    procedure TfrmMDIParent.spbPreviewClick(Sender: TObject);
    var
    lFormClass: TFormClass;

    begin
    if Memo1.Visible then Memo1.Visible := False;

    if (FPreview = nil) then
    begin

    lFormClass := ppGetFormClass(TppCustomPreviewer);
    FPreview := TppCustomPreviewer(lFormClass.Create(Self));

    FPreview.LanguageIndex := FReport.LanguageIndex;
    FPreview.OnActivate := ActivatePreviewerEvent;

    {note: the built-in preview dialog has an OnClose event handler that
    sets CloseAction to caFree, however for an mdi child window
    this
    is incorrect }
    FPreview.OnClose := nil;
    FPreview.Report := FReport;
    FPreview.Init;
    FPreview.FormStyle := fsMDIChild;

    end;

    {show preview child window}
    if (FPreview.WindowState <> wsMaximized) then
    FPreview.WindowState := wsMaximized;

    FPreview.BringToFront;

    end;

    {------------------------------------------------------------------------------}
    { ActivatePreviewerEvent }

    procedure TfrmMDIParent.ActivatePreviewerEvent(Sender: TObject);
    begin

    if (FPreview = nil) and (FReport = nil) then Exit;

    {reset the viewer to request page 1 of the report}
    if not FReport.IsCached then
    TppViewer(FPreview.Viewer).Reset;

    {print the report}
    FReport.PrintToDevices;

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.