Home General

Using AbsolutePageCount on Preview Form

edited October 2001 in General
In creating my own print preview form, I would like to be able to
enable/disable the next page button when the last page is previewed, and
validate the target page number in a goto page facility. As my reports are
two-pass, I would also like to be able to display "Page x of 15" from the
first showing, not only after the preview has navigated to the last page.
Well the first page has "Page 1 of 15" on it so surley there must be a way
to passing this information to the previewer?

Is there some way that I can do all these things?

My best attempt so far involves geting the page count in the following way:

procedure TrbPrintPreview.Activate;
begin
{this is in Activate because we want it to fire after OnPreviewFormCreate
and it's before Inherited to avoid caption flash.}
if DisplayDocumentName then
Caption := ppViewer1.Report.PrinterSetup.DocumentName;

inherited Activate;

ppViewer1.LastPage; {Get last page shown on status and store value in
variable FlastpageNum}
FlastpageNum := ppViewer1.AbsolutePageNo;
ppViewer1.FirstPage;

end;

But this does cause the page preview to "flash" while it moves page. Trying
this before the inherited Activate call (here or in form OnCreate, or
OnShow) gets the page count without the user seeing anything, but the
ppViewer.status then reverts to "Page 1" (no page count) style. It does seem
a waste this way, that having traversed the report I now I have the page
count and can configure the buttons etc, but it does not show it in the
status. I can't say I like this solution much either.

Any suggestions?

Sarah

Comments

This discussion has been closed.