unit UntObj;
interface
uses qforms,db;
type
MyInterface = class
procedure FrmShowModal(FrmOwner:TForm;FrmChil:TForm;rs:TDataset);
end;
implementation
procedure MyInterface.FrmShowModal(FrmOwner:TForm;FrmChil:TForm;rs:TDataset);
begin
if not assigned(FrmChil) then
FrmChil:=TForm.Create(FrmOwner);
FrmChil.ShowModal;
frmChil:=nil;
FrmChil.Free;
end;
end.在另一个文件中unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
MyIf:myinterface;
begin
Myif:=myinterface.Create;
Myif.FrmShowModal(self,FrmCompInfo,datamodule1.QueryCompInfo);
//Incompatible types: 'TForm' and 'TFrmCompInfo'
//Incompatible types: 'TForm' and 'TFrmMain'
myif:=nil;
myif.Free;
end;end.难道Tform还不能兼容TFrmMain吗?求教,希望得到指点
interface
uses qforms,db;
type
MyInterface = class
procedure FrmShowModal(FrmOwner:TForm;FrmChil:TForm;rs:TDataset);
end;
implementation
procedure MyInterface.FrmShowModal(FrmOwner:TForm;FrmChil:TForm;rs:TDataset);
begin
if not assigned(FrmChil) then
FrmChil:=TForm.Create(FrmOwner);
FrmChil.ShowModal;
frmChil:=nil;
FrmChil.Free;
end;
end.在另一个文件中unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
MyIf:myinterface;
begin
Myif:=myinterface.Create;
Myif.FrmShowModal(self,FrmCompInfo,datamodule1.QueryCompInfo);
//Incompatible types: 'TForm' and 'TFrmCompInfo'
//Incompatible types: 'TForm' and 'TFrmMain'
myif:=nil;
myif.Free;
end;end.难道Tform还不能兼容TFrmMain吗?求教,希望得到指点
解决方案 »
- 在DBGrid中能不能对TQuery的多表查询结果进行修改?另外怎么样根据查询的结果设置DBGrid的列。
- 北京一外企招Delphi开发人员
- 伟大的俺,发现了一个CSDN惊天大密秘!! 哇哈哈哈,各位JR进来告诉你们哈
- 1楼5楼25楼接分!
- 关于数据库基本操作问题
- 今天发现总信誉分张了15,郁闷~~~
- 贼简单的问题--怎样更改按钮的执行?
- 各位大哥,谁能传给我“中国式报表”控件呀,或者是下载地址等相关内容,急ing....
- oleVariant是个什么东西?怎么用?能转为String类型吗?
- delphi中关于一给模糊查询【很郁闷。。。】
- sock5代理服务器
- TdbEdit连接的是一个时间类型的字段,当输入的字符不合法时,程序就会瘫痪
TFrmCompInfo = class(TForm)
button1 : tbutton;
.....
end;
TFrmfrmmain = class(TForm)
button1 : tbutton;
.....
end;
Myif.FrmShowModal(self,TForm(FrmCompInfo),TForm(datamodule1.QueryCompInfo));
TFrmcompInfo,而是一个光光的TForm,我设计的TFrmcompInfo上的控件都不见了。怎么回事啊?