还有一个问题?
为什么在两个子窗口之间不能相互调用?如:
form1是form2,form3的父窗口
form2与form3相互都是用implementation uses连接
用form2创建form3
而form3却不能修改form2中的内容,提示form2=nil这是为什么?
为什么在两个子窗口之间不能相互调用?如:
form1是form2,form3的父窗口
form2与form3相互都是用implementation uses连接
用form2创建form3
而form3却不能修改form2中的内容,提示form2=nil这是为什么?
用FindWindow可以得到的。
findwindowex;
可以得。
Form2、Form3 禁止自动建立,由程序建立。没有任何问题
//Unit1 for Form1
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('ddl');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Form2:=TForm2.Create(nil);
Form2.Parent:=Panel1;
Form2.Visible:=True;
Form2.Align:=alClient;
end;
//Unit2 for Form2
var
Form2: TForm2;implementationuses Unit3, Unit1;{$R *.dfm}procedure TForm2.FormCreate(Sender: TObject);
begin
Form3:=TForm3.Create(nil);
Form3.Parent:=Form1.Panel2;
Form3.Visible:=True;
Form3.Align:=alClient;
end;procedure TForm2.Button1Click(Sender: TObject);
begin
Caption:=Form3.Caption;
end;
//Unit3 for Form3
var
Form3: TForm3;implementationuses Unit2;{$R *.dfm}procedure TForm3.Button1Click(Sender: TObject);
begin
Caption:=Form2.Caption;
end;