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

If new page then top ofpage?

edited September 2005 in General
Hello
I am using Delphi 6 with RB Enterprise 7.03.
When a report os previewed on screen and a user has, say, has the bottom
half of a page showing, and then changes to the next page, I want to have
the next page shown starting at the top of the page.

Any hints?

Thanks,
Russell Belding

Comments

  • edited September 2005
    Hi Russell,

    Though I have not tried this, you may be able to use one of the page events
    (OnStartPage perhaps) and take control of the scroll bar manually.


    The TppViewer.Scrollbox property provides access to the scrollbox. The
    Scrollbox VertScrollBar and HorzScrollbar properties can be used to set the
    scrolling position.

    There are a few options for getting access to the viewer:

    1. Use the Report.OnPreviewFormCreate event to access the Report.PreviewForm

    2. Create a custom preview dialog and register it with ReportBuilder. See
    ppPrvDlg.pas in RBuilder\Source

    3. Create a custom preview plug-in that is used by the preview dialog and
    the report designer. See ppPreview.pas in RBuilder\Source.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Thanks for your hint Nico. The behaviour wanted is now working. The
    behaviour wanted is to see each new page requested shown from the top of the
    page, not to leave the page shown as it was on the last page shown.

    1)
    In the class definition of the form containing myReport I declared
    myReportVertScrollBar : TControlScrollBar;

    2)
    In myReportPreviewFormCreate
    myReportVertScrollBar :=
    TppViewer(myReport.PreviewForm.Viewer).ScrollBox.VertScrollBar

    3)
    In event handler myReportPageRequest
    myReportVertScrollBar.position := 0;

    Thats it.

    The OnStartPage event handler fires once for each page made when the report
    is first made whereas OnPageRequest fires once when the report is made and
    once for each subsequent page change.

    Thanks,

    Russell Belding


  • edited September 2005
    Hi Russell,

    Excellent! Glad you got it working.

    --
    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.