如何在循环内响应键盘或鼠标事件?(50分)

E

elite

Unregistered / Unconfirmed
GUEST, unregistred user!
主线程有循环如下:<br>&nbsp; &nbsp;While testing do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;//程序体;<br>&nbsp; &nbsp; &nbsp; ...<br>&nbsp; &nbsp;end;<br>想在按下Enter键或鼠标点击Button1时给<br>&nbsp; &nbsp;testing:=False;<br>从而在下一次循环时退出。除了在该循环体中<br>使用多线程,从而使得击键和点击鼠标可以得<br>到响应,以便改变testing的值,还有没有更<br>好的办法?<br>请指教!<br>
 
在循环体里application.ProcessMessages;<br>在鼠标或键盘事件里testing:=false;
 
&nbsp; While testing do &nbsp; <br>&nbsp; &nbsp;begin &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp;Application.ProcessMessages;<br>&nbsp; &nbsp; &nbsp;//程序体; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp;... &nbsp; <br>&nbsp; &nbsp;end;
 
就是Application.Processmessages呀,放在循环里
 
都已经讨认过的啦。
 
application.ProcessMessages<br>结素问题吧
 
多人接受答案了。
 

Similar threads

回复
0
查看
658
不得闲
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
902
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部