Get TfrxReport component on OnBeforePrint


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



  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited May 31

    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.

  • PolomintPolomint Australia

    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:

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.