A TPageFrame defines the basic band structure for a printed page, including fixed and dynamic bands (see the Band Structure example for the basic layout). It provides a single "code loop" to cycle through the top-level "rows" of a report.

Execute a page frame by calling TPageFrame.Execute(ReportWriter).

An additional sub-frame can be linked to it via the TPageFrame.DetailFrame property (either a TMasterFrame or TDetailFrame component) to provide nested code loops and bands. You can also independently execute any number of nested frames in code.

Studying this diagramme and understanding it well can be the key to effectively using a TPageFrame.


Control Flow for a TPageFrame

When executed, a TPageFrame component cycles through a sequence of band output events: OnReportHeader, OnLetterhead, OnPageHeader, OnBodyTitle, OnBodyHeader, OnGroupHeader, OnRow, OnGroupFooter, OnBodyFooter, OnPageFooter, OnLetterfoot, OnRemittance and OnReportFooter. Each output event is preceded by a corresponding automatic band setup/definition process where band font and tab settings are applied. It includes a repeated loop which continues to cycle until invalidated in code by setting event parameter Valid := False within the loop.

Appropriate before/after events allow you to manipulate the process and add data access or other report infrastructure code.

The flow of events is represented in this diagramme:

Page Frame

Notes:

  1. The "Report" output events (OnReportHeader and OnReportFooter) are outside the fixed band page structure. Anything output in these events is always separated from the rest of the report by a page break. The pages so used are considered to be entirely outside the "report proper", and do not bear the page headers or page footers etc that every other page does. These events are intended for a report "cover sheet" or "follow-up sheet" (or anything else you wish to include in this logical position). Naturally, you could execute another frame component within these events if you wish...
  2. The "Page" output events (OnLetterhead, OnPageHeader, OnBodyTitle, OnPageFooter, OnLetterfoot) fire for every new page in the report (except those included in the ReportHeader and ReportFooter bands). The OnBodyTitle band is a special case in that it is a dynamic band (it does not have a fixed line count or height), but is included with the fixed bands because it is locked between these bands and the following dynamic body bands. BodyTitles are, for example, column headers that you want to appear at a fixed point (just below the fixed bands) at the top of each page. The OnRemittance band is also a special case band which only fires on demand (by explicitly enabling the band with a call to EnableRemittance).
  3. The "Body" output events (OnBodyHeader and OnBodyFooter) start and conclude output of the "dynamic body bands" of the report (the repeated loop part of the frame).
  4. The "Group loop" output events cycle in a repeated loop until Valid := False. A group loosely constitutes a single report row and its associated row details (if any). The latter triggers a sub-frame (TMasterFrame or TDetailFrame) linked via the property TPageFrame.DetailFrame. However, you are not bound by this underlying frame structure and can execute any other frame(s) you wish at any point.