Get TfrxReport component on OnBeforePrint
Hello,
I have function
procedure TMyForm.rpt_barcodesBeforePrint(Sender: TfrxReportComponent);
This procedure gives me TfrxReportComponent, but I need to find corresponding TfrxReport component.
Does anyone know how to get it on this level?
best regards
M
Comments
I think you need to follow (with a local TObject pointer) up the chain of parent pointers (or maybe owner) up from the component you are passed until the class of the object you get to is TfrxReport. Then cast it to a TfrxReport. You may pass though various bands, panels etc on the way.
G'day M (and LK),
If I remember correctly, TfrxComponent has a Property read-only called Report which is already type TfrxReport. So no need for any type-casting.
You should be able to just reference Sender.Report 😎
Cheers, Paul
See the Developer's Manual for more info: https://www.fast-report.com/public_download/DeveloperManual-en.pdf