[翻译]Writing Custom Wizards 编写自定义的向导
Writing Custom Wizards 编写自定义的向导
You can extend FastReport's functionality with the help of custom wizards. FastReport, for example, contains the standard “Report Wizard” which is called from the “File >|New…” menu item.
There are two types of wizards supported by FastReport. The first type includes the wizard already mentioned, called from the “File>New…” menu item. The second one includes wizards that can be called from the “Wizards” toolbar.
The base class for any wizard is “TfrxCustomWizard”, defined in the “frxClass” file.
TfrxCustomWizard = class(TComponent)
Public
Constructor Create(AOwner: TComponent); override;
class function GetDescription: String; virtual; abstract; //需要实现
function Execute: Boolean; virtual; abstract; //需要实现
property Designer: TfrxCustomDesigner read FDesigner;
property Report: TfrxReport read FReport;
end;
To write your own wizard inherit from this class and override at least the “GetDescription” and “Execute” methods. The first method returns the wizard name; the second method is called when running the wizard; it must return “True” if the wizard finished successfully and made any changes to the report. While the wizard is running you can access designer and report methods and properties as normal using the “Designer” and “Report” properties.
Wizard registration and deletion is performed using the procedures defined in the “frxDsgnIntf” file:
向导的注册用以下方法,声明在frxDsgnIntf文件:
frxWizards.Register(ClassRef: TfrxWizardClass; ButtonBmp: TBitmap;IsToolbarWizard: Boolean = False);
frxWizards.Unregister(ClassRef: TfrxWizardClass);
On registration supply the wizard class name, its picture and whether the wizard is to be placed on the “Wizards” toolbar. If the wizard should be placed on the toolbar the ButtonBmp size must be either 16x16 pixels or 32x32 pixels.
//举例
Let's look at a primitive wizard that will be accessed through the "File>New..." menu item. It adds a new page to a report.
uses frxClass, frxDsgnIntf;
type
TfrxMyWizard = class(TfrxCustomWizard)
public
//需要重写的方法
class function GetDescription: String; override;
function Execute: Boolean; override;
end;
class function TfrxMyWizard.GetDescription: String;
begin
Result := 'My Wizard';
end;
function TfrxMyWizard.Execute: Boolean;
var
Page: TfrxReportPage;
begin
{ lock any drawings in designer }
Designer.Lock;
{ create new page in report }
Page := TfrxReportPage.Create(Report);
{ create unique name for page }
Page.CreateUniqueName;
{ set paper sizes and orientation to defaults }
Page.SetDefaults;
{ update report pages and switch focus to last added page }
Designer.ReloadPages(Report.PagesCount - 1);
end;
//注册
var
Bmp: TBitmap;
initialization
Bmp := TBitmap.Create;
{ load picture from resource; of course, it must already be there }
Bmp.LoadFromResourceName(hInstance, 'frxMyWizard');
frxWizards.Register(TfrxMyWizard, Bmp);
finalization
frxWizards.Unregister(TfrxMyWizard);
Bmp.Free;
end.
[翻译]Writing Custom Wizards 编写自定义的向导的更多相关文章
- [翻译]Writing Custom Report Components 编写自定义报表组件
摘要:简单介绍了如何编写一个FastReport的组件,并且注册到FastReport中使用. Writing Custom Report Components 编写自定义报表组件 FastRep ...
- [翻译]Writing Custom Common Controls 编写自定义控件
摘要:介绍如何编写自定义的控件,用在报表的窗体上(如Edit,Button等) Writing Custom Common Controls 编写自定义控件 FastReport contains ...
- [翻译]Writing Custom DB Engines 编写定制的DB引擎
Writing Custom DB Engines 编写定制的DB引擎 FastReport can build reports not only with data sourced from ...
- [翻译]Writing Component Editors 编写组件的编辑器
Writing Component Editors 编写组件的编辑器 All common control editors (opened from a control's context me ...
- [翻译] Writing Property Editors 编写属性编辑器
Writing Property Editors 编写属性编辑器 When you select a component in the designer its properties are di ...
- (译)Getting Started——1.3.4 Writing a Custom Class(编写自定义的类)
在开发IOS应用中,当你编写自定义的类时,你会发现很多的特殊场合.当你需要把自定义的行为和数据包装在一起时,自定义的类非常有用.在自定义的类中,你可以定义自己的存储.处理和显示数据的方法. 例如,I ...
- django “如何”系列4:如何编写自定义模板标签和过滤器
django的模板系统自带了一系列的内建标签和过滤器,一般情况下可以满足你的要求,如果觉得需更精准的模板标签或者过滤器,你可以自己编写模板标签和过滤器,然后使用{% load %}标签使用他们. 代码 ...
- SpringBoot编写自定义的starter 专题
What’s in a name All official starters follow a similar naming pattern; spring-boot-starter-*, where ...
- Kubernetes 编写自定义 controller
原文链接:Kubernetes编写自定义controller 来自kubernetes官方github的一张图: 如图所示,图中的组件分为client-go和custom controller两部分: ...
随机推荐
- Java动态代理的实现方法
AOP的拦截功能是由java中的动态代理来实现的.说白了,就是在目标类的基础上增加切面逻辑,生成增强的目标类(该切面逻辑或者在目标类函数执行之前,或者目标类函数执行之后,或者在目标类函数抛出异常时候执 ...
- Django搭建数据库
---恢复内容开始--- 一.form表单提交数据的三个要素 1.form标签必须要有action个和method属性 2.所有获取用户输入的标签必须放在form表单中,必须要有name属性 3.必须 ...
- Spring编程式事务管理
--------------------siwuxie095 Spring 编程式事务管理 以转账为例 ...
- 33. Search in Rotated Sorted Array旋转数组二分法查询
一句话思路:反正只是寻找一个最小区间,断开也能二分.根据m第一次的落点,来分情况讨论. 一刷报错: 结构上有根本性错误:应该是while里面包括if,不然会把代码重复写两遍,不好. //situati ...
- dedecms的自定义模块
dedecms的自定义模块 1.在dedecms主目录下创建一个模块目录 2.在模块目录下创建如下目录 网站根目录/ |-自定义模块 |-control 控制器 |-model 模型 |-stat ...
- 如何区分USB 2.0 和USB 3.0插口
USB3.0的速度是USB2.0的十倍,并且比USB2.0更加节能,同时,还能向下兼容USB2.0.那么,我们怎么区分USB2.0 和 USB 3.0呢. 电脑(有USB2.0和USB3.0的插口) ...
- 构建openssl debug版
一.简介 作为一种安全协议,openssl囊括了主要的密码算法.常用的密钥和证书封装管理功能以及SSL协议,并提供了丰富的应用程序供测试或其它目的使用. 参考: http://www.linuxidc ...
- Nginx下SSL证书设置和反向代理
上来就贴代码: server { listen ; server_name **.****.net; #填写绑定证书的域名 ssl on; ssl_certificate /opt/nginx-/co ...
- 属性表格 datagridproperty
http://www.cnblogs.com/yxlblogs/p/3468921.html
- c++11多线程学习笔记之一 thread基础使用
没啥好讲的 c++11 thread类的基本使用 #include "stdafx.h" #include <iostream> #include <thre ...