在窗體,form1中,有控件edit1:Tedit和Button1:TButton 。
光標在edit1上,設edit1的onexit事件 中有一些特殊代碼............
Button1的Button1Click事件edit1.Enabled:=false;
當程序運行,我點Button1時,我要想程序不執行edit1的onexit事件 。
請問有什麼方法?
光標在edit1上,設edit1的onexit事件 中有一些特殊代碼............
Button1的Button1Click事件edit1.Enabled:=false;
當程序運行,我點Button1時,我要想程序不執行edit1的onexit事件 。
請問有什麼方法?
我同時要執行edit1.Enabled:=false啊。
你执行了它的onExit事件,是因为你有焦点
如果你把from1的activecontrol和button1关联就不会了
把原来你的特殊代码写成一个过程: procedure1;
在除button1.click事件外的代码里判断edit1_exit的值是否为true,是则调用procedure1。
有点罗嗦了点,不过行的通。
begin
if form1.ActiveControl <> button1 then
begin
.........
end;
end;
这样可能不行吧,好象是edit先失去焦点,然后引发onexit,然后button获得焦点。
你說你可是可以,但如是給button1設個快捷鍵,使快捷鍵的時候edit1還是
给点分吧,我分长的好慢呀。
在edit1中的onexit中这样写
if b=true
exit;
else
begin
b:=fasle;
.
......你的代码...
end;