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

How to scroll to the end of a report

edited March 2012 in General
Hi,

I am displaying a stored archive file in a Viewer.
What I need is to scroll in view the last page of the report using a one
page continued view.
I tried:

1. LastPage
2. Setting the scrollbar position

both in the AfterPrint event. No success.
Even when I place the code in the OnFormActivate-event (the report is
printed in OnCreate) it doesn't work.

How can I display the last page just after loading the file into the viewer?

Thanks and regards Uli

Comments

  • edited March 2012
    Update:

    That seems to work:

    procedure TFaxPreviewForm.BefundViewerPrintStateChange(Sender: TObject);
    begin
    BefundViewer.Scroll(dtDown);
    end;

    Is there a better solution?

    Regards Uli
  • edited March 2012
    Hi Uli,

    Yes, this is the correct event to use however, rather than use the
    Scroll routine, first check for Viewer.Busy, if not, make the call to
    LastPage.

    if not(BefundViewer.Busy) then
    BefundViewer.LastPage;

    Best Regards,

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


    Good hint. Thanks a lot.

    BTW: when i open an archive file in a viewer, the cursor stays at
    crHourglass for some seconds though the report is displayed completely
    and immediately.
    Does that mean, the viewer is still busy? And if so: what does the
    viewer do, after the report has been displayed?

    Best regards Uli
  • edited March 2012
    Update:

    I checked for Viewer.busy by using a timer. Seems to have another
    reason. But it only occurs in two forms which use a viewer.

    Regards Uli
  • edited March 2012
    Hi Uli,

    This likely does mean that the thread generating pages is still busy.
    When the report thread is complete, the Viewer.PrintStateChange event is
    fired and the cursor is changed back to an arrow. The Viewer.Busy is
    also returns false at this point.

    Best Regards,

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


    As I mentioned I checked Viewer.Busy and it's false while the cursor
    keeps crHourglass.

    I tried that with a very simple and small report of one page. After
    displaying the report and Viewer.Busy = false, the cursor keeps at
    crHourglass for some seconds.

    That's a litte bit disturbing because the user may wait to continue his
    work, though it's not necessary.

    Any ideas?

    Thanks and regards Uli
  • edited March 2012
    Hi Uli,

    Are you able to recreate this with an example I could run here. All
    tests I try, the hour glass/spinning circle disappears once the report
    is finished generating.

    If possible, please send the example in .zip format to
    support@digital-metaphors.com and I'll take a look at why it is behaving
    differently.

    Best Regards,

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


    I'll try. The problem is, that it doesn't occur *always* and I don't see
    a "rule".
    And: from the moment I read your message, it didn't occur any more in
    many tries. :(

    Thanks and regards Uli
This discussion has been closed.