>>关于窗体关闭的有关问题?
>>---------------关于窗体关闭的问题?------------------------------
当窗体不是在一开始就加载的时候,也就是动态产生的:
也就是用如下代码:
if not Assigned(RepLableForm) then RepLableForm.Free;
RepLableForm:=TRepLableForm.Create(self);
RepLableForm.ShowModal;
时,如果在那个窗体中,录入数据后,用判断语句:
if Edit1.Text= ' ' then
begin
ShowMessage( '请输入简写代码 ');
Edit1.SetFocus;
Exit;
end;
-----------------------------------------------
请问:
为什么窗体就消失了?如果用SHOW的方式产生该窗体就不会消失?
如果偶想用ShowModal的方法产生,但又不想窗体在判断时消失的话,有没好的办法?
------解决方案--------------------
if not Assigned(RepLableForm) then RepLableForm.Free;
非得要這句嗎?
你取消了試試!!!
------解决方案--------------------
你的 RepLableForm 上应该有个关闭按钮
把RepLableForm 上那个 关闭按钮 ModalResult 属性设置为 mrNone
------解决方案--------------------
去掉 Exit;
当窗体不是在一开始就加载的时候,也就是动态产生的:
也就是用如下代码:
if not Assigned(RepLableForm) then RepLableForm.Free;
RepLableForm:=TRepLableForm.Create(self);
RepLableForm.ShowModal;
时,如果在那个窗体中,录入数据后,用判断语句:
if Edit1.Text= ' ' then
begin
ShowMessage( '请输入简写代码 ');
Edit1.SetFocus;
Exit;
end;
-----------------------------------------------
请问:
为什么窗体就消失了?如果用SHOW的方式产生该窗体就不会消失?
如果偶想用ShowModal的方法产生,但又不想窗体在判断时消失的话,有没好的办法?
------解决方案--------------------
if not Assigned(RepLableForm) then RepLableForm.Free;
非得要這句嗎?
你取消了試試!!!
------解决方案--------------------
你的 RepLableForm 上应该有个关闭按钮
把RepLableForm 上那个 关闭按钮 ModalResult 属性设置为 mrNone
------解决方案--------------------
去掉 Exit;