控件属性Parameters的问题

gzj8143586 2005-08-04 01:58:30
我这个控件是继承TSpeedButton类的,只是想有一个Parameters属性。
TDyHotQry = class(TSpeedButton)
private
FParameters : TParameters;
...
protected
public
constructor Create(AOwner : TComponent); override;
...
published
property Parameters : TParameters read FParameters write SetParamsList;
...
end;
constructor TDyHotQry.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
Glyph.LoadFromResourceName(HInstance,'TDyHOTQRY');
...
FParameters := TParameters.Create(a1,a2); {输入/输出参数}
...
end;

就是上面的a1,a2两个参数该怎么写。我乱写了很多,都不行,后来用FParameters := TParameters.Create(self,TParameter);生成控件后,我在用的过程中提示错误“invalid class typecast ” 这是怎么回事呢?
...全文
133 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzj8143586 2005-08-05
  • 打赏
  • 举报
回复
unit dyHotQry;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics,ADODB, Controls, Forms, Dialogs,
Buttons, DBTables, DB,DyQry,DBGrids,Variants;

type

THotQryParam = class;
// 热键查询控件
TDyHotQry = class(TSpeedButton)
private
FCode : string;
FLang : string;
FQryValue : Variant;
FQuery : TDyQuery;
FParams : TParams;
FAllowExit : Boolean;
FHotQryParam : THotQryParam;
procedure SetQryValue(Value : Variant);
procedure SetParamsList(Value: TParams);
procedure SetHotQryParam(Value : THotQryParam);
protected
public
property Lang : string read FLang write FLang;
property Query : TDyQuery read FQuery write FQuery;
function RunQry(TheEvent : String): boolean; //启动Hot Form
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
function ExitOrClick(TheEvent : String) : boolean;
published
property AllowExit : boolean read FAllowExit write FAllowExit;
property Code : string read FCode write FCode;
property Visible default False;
property NumGlyphs default 2;
property Flat default True;
procedure Click; override;
property Params : TParams read FParams write SetParamsList;
property QryValue : Variant read FQryValue write SetQryValue;
property HotQryParam : THotQryParam read FHotQryParam write SetHotQryParam;
end;

THotQryParam = class(TPersistent)
private
FQryName : String;
FQryTable : TStrings;
FqryListFields : TStrings;
FqryQueryFields : TStrings;
FqryResultFields : TStrings;
FqryFilter : TStrings;

procedure SetQryName(Value: String);
procedure SetQryTable(Value: TStrings);
procedure SetqryListFields(Value: TStrings);
procedure SetqryQueryFields(Value: TStrings);
procedure SetqryResultFields(Value: TStrings);
procedure SetqryFilter(Value: TStrings);
public
constructor Create; virtual;
destructor Destroy; override;
published
Property QryName : String read Fqryname write SetQryName;
Property QryTable : TStrings read FqryTable write SetQryTable;
Property QryListFields : TStrings read FqryListFields write SetqryListFields;
Property QryQueryFields : TStrings read FqryQueryFields write SetqryQueryFields;
Property QryResultFields : TStrings read FqryResultFields write SetqryResultFields;
Property QryFilter : TStrings read FqryFilter write SetqryFilter;
end;
constructor TDyHotQry.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
Query:=dydb.dmPBDb1.Qry_temp;
{从资源文件中取出图标}
Glyph.LoadFromResourceName(HInstance,'TDyHOTQRY');
Visible := False;
NumGlyphs := 1;
Flat := True;
AllowExit := false;
ShowHint := true;
FQryValue := '';
Hint := 'Press F2 Query' ;
FParams := TParams.Create(Self); {输入/输出参数}
FHotQryParam := THotQryParam.Create;{列示字段,查询字段等......}
end;

怎么把上面的 FQuery : TdyQuery;
FParams : TParams;
改成 FQuery : TadoQuery;
FParams : TParameters;
gzj8143586 2005-08-05
  • 打赏
  • 举报
回复
但我用TParams就行啊,为什么用TParameters却不行
hangguojun 2005-08-05
  • 打赏
  • 举报
回复
TParameters 隶属于 ADODB,是个数据库相关

可以在这里用吗?
gzj8143586 2005-08-05
  • 打赏
  • 举报
回复
有没有人能告诉我啊
gzj8143586 2005-08-05
  • 打赏
  • 举报
回复
人呢
gzj8143586 2005-08-04
  • 打赏
  • 举报
回复
那要从什么类继承啊
xixuemao 2005-08-04
  • 打赏
  • 举报
回复
你别从speedbutton继承试试。
gzj8143586 2005-08-04
  • 打赏
  • 举报
回复
想做一个按钮,直接点击它,就可以出现一个对话框,里面出现一个TADOQUERY类查询出来的值
xixuemao 2005-08-04
  • 打赏
  • 举报
回复
那你继承speedbutton用这个属性干吗?
gzj8143586 2005-08-04
  • 打赏
  • 举报
回复
没人能够回答出这个问题吗?
gzj8143586 2005-08-04
  • 打赏
  • 举报
回复
其它的控件不可以有这个属性吗?
LocustWei 2005-08-04
  • 打赏
  • 举报
回复
TParameters; 是专门给Ado用的。

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧