FastReport Class Hierarchy |
Top Next |
"TfrxComponent" is the base class for all FastReport components. Objects of this type have attributes such as “coordinates”, “size”, “font” and “visibility” and have lists of subordinate objects. The class also has methods which allow for the saving and restoration of the object state to or from a stream.
TfrxComponent = class(TComponent) protected procedure SetParent(AParent: TfrxComponent); virtual; procedure SetLeft(Value: Extended); virtual; procedure SetTop(Value: Extended); virtual; procedure SetWidth(Value: Extended); virtual; procedure SetHeight(Value: Extended); virtual; procedure SetFont(Value: TFont); virtual; procedure SetParentFont(Value: Boolean); virtual; procedure SetVisible(Value: Boolean); virtual; procedure FontChanged(Sender: TObject); virtual; public constructor Create(AOwner: TComponent); override; procedure Assign(Source: TPersistent); override; procedure Clear; virtual; procedure CreateUniqueName; procedure LoadFromStream(Stream: TStream); virtual; procedure SaveToStream(Stream: TStream); virtual; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Extended); function FindObject(const AName: String): TfrxComponent; class function GetDescription: String; virtual;
property Objects: TList readonly; property AllObjects: TList readonly; property Parent: TfrxComponent; property Page: TfrxPage readonly; property Report: TfrxReport readonly; property IsDesigning: Boolean; property IsLoading: Boolean; property IsPrinting: Boolean; property BaseName: String;
property Left: Extended; property Top: Extended; property Width: Extended; property Height: Extended; property AbsLeft: Extended readonly; property AbsTop: Extended readonly;
property Font: TFont; property ParentFont: Boolean; property Restrictions: TfrxRestrictions; property Visible: Boolean; end;
The following methods are called when modifying the corresponding properties. If additional handling is needed, you can override them:
- SetParent - SetLeft - SetTop - SetWidth - SetHeight - SetFont - SetParentFont - SetVisible - FontChanged
The following properties are defined in the “TfrxComponent” class:
The next base class is “TfrxReportComponent”. Objects of this type can be placed into a report design. This class has the “Draw” method for drawing the object and also the “BeforePrint/GetData/AfterPrint” methods, which are called when the report is running.
TfrxReportComponent = class(TfrxComponent) public procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); virtual; abstract; procedure BeforePrint; virtual; procedure GetData; virtual; procedure AfterPrint; virtual; function GetComponentText: String; virtual; property OnAfterPrint: TfrxNotifyEvent; property OnBeforePrint: TfrxNotifyEvent; end;
The "Draw" method is called to draw the object, with parameters:
The "BeforePrint" method is called immediately before object handling (during the report building process). This method saves the object state.
The "GetData" method is called to load data into the object.
The "AfterPrint" method is called after object handling. This method restores the object state.
"TfrxDialogComponent" is the base class for writing non-visual components that can be used in dialogue forms in a report.
TfrxDialogComponent = class(TfrxReportComponent) public property Bitmap: TBitmap; property Component: TComponent; published property Left; property Top; end;
“TfrxDialogControl” is the base class for writing common controls that can be used in dialogue forms in a report. This class has a large number of general properties and events shared by most of the common controls.
TfrxDialogControl = class(TfrxReportComponent) protected procedure InitControl(AControl: TControl); public property Caption: String; property Color: TColor; property Control: TControl; property OnClick: TfrxNotifyEvent; property OnDblClick: TfrxNotifyEvent; property OnEnter: TfrxNotifyEvent; property OnExit: TfrxNotifyEvent; property OnKeyDown: TfrxKeyEvent; property OnKeyPress: TfrxKeyPressEvent; property OnKeyUp: TfrxKeyEvent; property OnMouseDown: TfrxMouseEvent; property OnMouseMove: TfrxMouseMoveEvent; property OnMouseUp: TfrxMouseEvent; published property Left; property Top; property Width; property Height; property Font; property ParentFont; property Enabled: Boolean; property Visible; end;
When writing your own custom control, you should inherit from this class, move the required properties to the “published” section, and then add new properties for your common control. The writing of custom controls will be discussed in detail in the next chapter.
"TfrxView" is the base class for most components that can be placed on the report design page. Objects of this class have attributes such as “Frame” and “Filling” and can also be connected to a data source. Most FastReport standard objects inherit from this class.
TfrxView = class(TfrxReportComponent) protected FX, FY, FX1, FY1, FDX, FDY, FFrameWidth: Integer; FScaleX, FScaleY: Extended; FCanvas: TCanvas; procedure BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); virtual; procedure DrawBackground; procedure DrawFrame; procedure DrawLine(x, y, x1, y1, w: Integer); public function IsDataField: Boolean; property BrushStyle: TBrushStyle; property Color: TColor; property DataField: String; property DataSet: TfrxDataSet; property Frame: TfrxFrame; published property Align: TfrxAlign; property Printable: Boolean; property ShiftMode: TfrxShiftMode; property TagStr: String; property Left; property Top; property Width; property Height; property Restrictions; property Visible; property OnAfterPrint; property OnBeforePrint; end;
The following methods are defined in this class:
Calculated values are exposed as FX, FY, FX1, FY1, FDX and FDY variables. Frame width (exposed as FFrameWidth) is also calculated
One can refer to the following properties after calling the “BeginDraw” method:
- FX, FY, FX1, FY1, FDX, FDY,
- FscaleX,
The class defines the following properties, which are found in most report objects:
"TfrxStretcheable" is the base class for writing components which modify their height depending on the data placed in them.
TfrxStretcheable = class(TfrxView) public function CalcHeight: Extended; virtual; function DrawPart: Extended; virtual; procedure InitPart; virtual; published property StretchMode: TfrxStretchMode; end;
Objects of this class can be stretched vertically and also split into smaller pieces when the objects don't have sufficient width on the output page. The objects are split enough times to fit all of their data into the available space.
The following methods are defined in this class:
“Return value” is the amount of unused space where it was impossible to display data
|