如果这两个mdi子窗口不是一样的,直接用窗口的name去操作,我想不会有问题!!!!(同其它窗口一样操作)
解决方案 »
- 一个关于TreeView的问题,在线等,急!!!!!!!!!!
- 我把参数传到一个prodedure 去执行,可是出错了,我看了好几遍了,大家帮忙
- 特别复杂的报表怎么实现呀
- unicode与ascii码的有什么不同?如何把UNICODE转成ASCII呢?
- 关于使用Access的优势
- 这种方法可以吗?如果可以,如何实现?
- 函数OleCheck
- 在DBGrid里怎么实现自动统计的功能啊?
- Microsoft 的mscomm控件要怎么用?出现licence of Tmscomm not found.you can not use this control,on the design!要怎么办?急!!
- 急 急 急,高分求解,如何在delphi中使用win32 api?????
- mss这个号的问题怎么没人回答啊,请各位大侠帮他啊
- 如何遍历光盘里的所有目录及文件?
USES 子窗口2的UNIT文件
在调用子窗口2中的控件
如:s:=子窗口2.form2.edit1.text
为什么不能通过Caption?就两个窗口,不麻烦啊。
然后通过MDIChildCount和MDIChildren[i]来确定该窗体
procedure TMain.N1Click(Sender: TObject);
var
P:TForm2;
begin
if(MdiChildCount>2) then
begin
MessageDlg('子窗口不能超过三个!',mtWarning,[mbOK],0);
Exit;
end;
P:=TForm2.Create(Application);
p.Tag:=j+1;
p.Label1.Caption:=IntToStr(p.Tag);
j:=j+1;
p.Width:=400;
p.Height:=400;
p.Caption:='Windows'+IntToStr(J);
p.show;end;procedure TMain.Control(i: integer);
begin
MdiChildren[i].BringToFront;
end;
end.
procedure TForm2.FlatButton2Click(Sender: TObject);
begin
Main.Control(StrToInt(Edit1.Text));
end;//mdi子窗口的代码//现在问题就是每次都不能准确的把我指定的窗口show出来,代码错在哪里了?
P:TForm2;
begin
if(MdiChildCount>2) then
begin
MessageDlg('子窗口不能超过三个!',mtWarning,[mbOK],0);
Exit;
end;
P:=TForm2.Create(Application);
p.Tag:=j+1;
p.Label1.Caption:=IntToStr(p.Tag);
j:=j+1;
p.Width:=400;
p.Height:=400;
p.Caption:='Windows'+IntToStr(J);
p.show;
end;procedure TMain.Control(i: integer);
begin
MdiChildren[i].BringToFront;
end;
end.
//子窗口代码procedure TForm2.FlatButton2Click(Sender: TObject);
begin
Main.Control(StrToInt(Edit1.Text));
end;//现在问题就是每次都不能准确的把我指定的窗口show出来,而且当我在子窗口的edit框里输入3的时候程序就会出错
if(MdiChildCount>2) then
begin
MessageDlg('子窗口不能超过三个!',mtWarning,[mbOK],0);
Exit;
end;
2、MdiChildren[index]不能保证索引对应窗口,也就是说你的mdiChildren[0]可能一会儿是windows1,一会儿是windows2.
2.mdichildren的索引窗口方法不正确,mdichildren[0]可能一会儿是windows0一会儿是windows1,可能mdichildren是与窗口的z order有关的。
unit unit1
……
use ……,unit2;
……
procedure TForm1.Button1Click(Sender: TObject);
var
Form2: TForm2;
begin
Form2:=TForm2.create(self);
Form2.visible:=True;
end;
if(MdiChildCount>2) then
begin
MessageDlg('子窗口不能超过三个!',mtWarning,[mbOK],0);
Exit;
end;