A TMasterFrame is a dynamic band frame that can be linked as a "detail frame" to a parent PageFrame or to another TMasterFrame via their DetailFrame property, or executed independently at any point in a report by calling TMasterFrame.Execute(ReportWriter). It provides a single "code loop" to cycle through a "group of rows" in a report, but lacks the fixed band page elements of a TPageFrame.
Studying this diagramme and understanding it well can be the key to effectively using a TMasterFrame.
Control Flow for a TMasterFrame
When executed, a TMasterFrame component cycles through a sequence of band output events: OnBodyHeader, OnGroupHeader, OnRow, OnGroupFooter, and OnBodyFooter. These output events are where you write your report output code. 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:
- The "Body" output events (OnBodyHeader and OnBodyFooter) start and conclude output of the "dynamic group bands" of the report (the repeated loop part of the frame).
- 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 TMasterFrame.DetailFrame. However, you are not bound by this underlying frame structure and can execute any other frame(s) you wish at any point.