FastReport中国社区FastReport联系电话 联系电话:023-68661681

FastReport VCL开发人员手册:事件处理程序描述

来源:   发布时间:2021-07-07   浏览:次

FastReport VCL是用于 Delphi、C++ Builder、RAD Studio 和 Lazarus 的报告和文档创建 VCL 库。它提供了可视化模板设计器,可以访问 30 多种格式,并可以部署到云、网站、电子邮件和打印中。

立即点击下载FastReport VCL v6.9最新版

如果需要定义一个不属于基本类的新事件处理程序,应该怎么做?让我们以TfrxEditControl通用控件为例进行检查:

  TfrxEditControl = class(TfrxDialogControl)
  private
    FEdit: TEdit;
    { new event }
    FOnChange: TfrxNotifyEvent;
    procedure DoOnChange(Sender: TObject);
    ...
  public
    constructor Create(AOwner: TComponent); override;
    ...
  published
    { new event }
    property OnChange: TfrxNotifyEvent read FOnChange write FOnChange;
    ...
  end;

constructor TfrxEditControl.Create(AOwner: TComponent);
begin
  ...
  { connect our handler }
  FEdit.OnChange := DoOnChange;
  InitControl(FEdit);
  ...
end;

procedure TfrxEditControl.DoOnChange(Sender: TObject);
begin
  { call event handler }
  if Report <> nil then
    Report.DoNotifyEvent(Sender, FOnChange);
end;

需要注意的是,FastReport 中的事件处理程序是在报告脚本中声明的过程。包含其名称的字符串将是指向处理程序的链接。这就是为什么,例如,不像 DelphiTNotifyEvent类型,它是方法地址,处理程序类型,在 FastReport 中它是字符串(TfrxNotifyEvent类型声明为 String[63])。

如果您对 FastReport 感兴趣,欢迎加入 FastReport QQ 交流群:702295239

还想要更多吗?您可以点击阅读【FastReport报表2021最新资源盘点】,查找需要的教程资源。上是FastReport .NET慧正在网火热销售中!>>查看价格详情

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:FastReport控件中文网 [https://www.fastreportcn.com/]
本文地址:https://www.fastreportcn.com/post/3133.html

联系我们
  • 重庆总部 023-68661681
购买
  • sales@evget.com
合作
  • business@evget.com


扫码咨询
电话咨询
023-68661681
返回
顶部