scroll preview window to last page
FAlvarado
US/Mexico
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
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
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
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;
worksFrancisco Alvarado
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