scroll preview window to last page

Is there a way to go to the last page in a frxReport?

Like clicking the doble right arrow in the tools of the preview window or better yet to move page by page and back to the first page w]from the last.

I found frxReport1.PreviewPages..FistPage but no LastPage

frxReport1.PreviewPages.Page[frxReport1.PreviewPages.Count -1] doesn't work

Best Regards

Francisco Alvarado

Comments

  • PolomintPolomint Australia

    G'day Francisco,

    I've had a quick look at the source (we have a licence for v2022.1.6 Enterprise of FR Vcl) and am "puzzled".

    In theory you should be able to call the Last method of the Preview Object. (That is in fact what the Event Handler TfrxPreviewForm.LastBClick declred in frxPreview.pas does.) This method sets PageNo to PageCount.

    But an experiment in a Test Project shows this to be uncompilable! The method is declared Public so I've hit a dead-end. In fact PageNo itself should be Public so I think I've missed something important! I'll try to look at this more closely tomorrow...

    Oh, and I don't think that the FirstPage Property is what you think it is! The comments associated with its declaration show it to be the "First page number in composite report", and the code suggests it is a "passive" element.

    More later if I find anything useful to you...

    Cheers, Paul

  • PolomintPolomint Australia
    edited March 2022

    G'day (again) Francisco.

    (Amazing what walking away and having something to eat will do...)

    On reinspection the source code showed that while TfrxPreview does make the method (and property) Public, it is not that Component that is used to declare the Preview property, but the "custom" ancestor in which they are Private.

    So a simple fix (that worked in our Test Project) is to call Last this way:

    TfrxPreview (Report.Preview).Last;

    I put the call after the line of code that displays the Preview Form. Now every report I run in the Test Project "previews" showing the last page as the default!

    I hope that is helpful...

    Cheers, Paul

  • FAlvaradoFAlvarado US/Mexico
    edited March 2022

    Thank you Paul! I'll try your solution ASAP because it's the only alternative for my previous post: to display different reports in the same form.

    I'll use that in a dashboard that will scroll (using a TTimer) to show all records in the report.

    I'll test also if TfrxPreview (Report.Preview).Next; works

    Francisco Alvarado

  • FAlvaradoFAlvarado US/Mexico

    Paul:

    So far, this is working as expected:

    procedure TDashBF3.VrTimer1Timer(Sender: TObject);

    begin

     // Browse all pages in report

     if TfrxPreview(frxReport1.Preview).PageNo = TfrxPreview(frxReport1.Preview).PageCount then

      TfrxPreview(frxReport1.Preview).First

     else

      TfrxPreview(frxReport1.Preview).Next;

    end;

    thank you

    Francisco Alvarado

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.