How to assign Delphi OnBeforePrint event handler?

edited October 2016 in FastReport VCL 5
Hi all!

I want to assign an OnBeforePrint handler implemented in Delphi to a TfrxPictureView at runtime, something like
  procedure InitPicture(const AName: string);
  var
    c: TComponent;
    pict: TfrxPictureView;
  begin
    c := fastReport1.FindComponent(AName);
    if Assigned(c) and (c is TfrxPictureView) then
    begin
      pict := TfrxPictureView(c);
      pict.OnBeforePrint := Picture2BeforePrint;
    end;
  end;
with a method
  TMyClass = class(...)
    ...
    procedure Picture2BeforePrint(Sender: TfrxComponent);
    ...
  end;
but of course this doesn't work because <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->TfrxReportComponent.OnBeforePrint<!--fontc--></span><!--/fontc--> is in fact a string property, not an event property.

How can I achieve my goal?

Comments

  • gpigpi
    edited 3:41PM
    You may assign TfrxPictureView.OnBeforePrint with script procedure only
    Use TfrxReport.OnBeforePrint event for Delphi's code
  • edited 3:41PM
    gpi wrote: »
    You may assign TfrxPictureView.OnBeforePrint with script procedure only
    Use TfrxReport.OnBeforePrint event for Delphi's code
    Thanks for your answer, gpi!

Leave a Comment