form的showmodal碰到的问题
时间:2011-08-15
来源:互联网
form1上有一个Button1
uses unit2,unit3;
button1.click事件调用form2
with tForm2.create(self) do
try
showmodal;
finally
free;
end;
form2上也有一个Button1
uses unit1,unit3;
button1.click事件调用form3
with tForm3.create(self) do
try
showmodal;
finally
free;
end;
再建一form3,也放一button
uses unit2,unit1
button1.click事件中showmessage(form2.button1.caption)总是报access violation错误
但如果在form2上放一button ,click事件中showmessage(form1.button1.caption)不报错
这是什么原因呀,请问才能在form3中调用form2中组件的值 呢?
uses unit2,unit3;
button1.click事件调用form2
with tForm2.create(self) do
try
showmodal;
finally
free;
end;
form2上也有一个Button1
uses unit1,unit3;
button1.click事件调用form3
with tForm3.create(self) do
try
showmodal;
finally
free;
end;
再建一form3,也放一button
uses unit2,unit1
button1.click事件中showmessage(form2.button1.caption)总是报access violation错误
但如果在form2上放一button ,click事件中showmessage(form1.button1.caption)不报错
这是什么原因呀,请问才能在form3中调用form2中组件的值 呢?
作者: n29882942 发布时间: 2011-08-15
我很好奇,你能够在再Form2上再创建一个Form3
作者: rainychan2009 发布时间: 2011-08-15
你把uses的位置放到implementation下面试下看,
还有应该就是和shomodal模式有关
还有应该就是和shomodal模式有关
作者: omagic 发布时间: 2011-08-15
因为Form1是主窗口,而Form2不是,你在建立时没有给Form2赋值,Form2为空指针。如改成:
Form2 := TForm2.Create(self);就可以了。
Form2 := TForm2.Create(self);就可以了。
作者: Oraclers 发布时间: 2011-08-15
form1上有一个Button1
uses unit2,unit3;
button1.click事件调用form2
with tForm2.create(self) do
try
showmodal;
finally
free;
end;
with tForm2.create(self) do 这里建成的非FORM2这个变量
在FORM1里建FORM2,应该用
form2:= tform2.Create(nil);
form2.ShowModal;
form2.Free;
uses unit2,unit3;
button1.click事件调用form2
with tForm2.create(self) do
try
showmodal;
finally
free;
end;
with tForm2.create(self) do 这里建成的非FORM2这个变量
在FORM1里建FORM2,应该用
form2:= tform2.Create(nil);
form2.ShowModal;
form2.Free;
作者: dinoalex 发布时间: 2011-08-15
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28