Board index » delphi » Handling another event while in an event handler??

Handling another event while in an event handler??

What is the preferred method for handling another event while inside
an event handler.  I have an event handler that has a loop that I need
to break out of with the click of a button.  Any suggestions on how I
do this?  I've looked through the documentation (such as it is) and
can't find information on this subject.

Thanks

Al

===========================================================
 Al Testani ============= Boca Raton, FL ==============  a...@emi.net
===========================================================

 

Re:Handling another event while in an event handler??


Place a call to Application.ProcessMessages in the loop.  This will allow
other events to be handled - and allow other Windows apps to run!

Set a flag in the button handler which is tested in your loop.

Finished := False;
Aborted := False;
repeat
   Finished := DoSomeProcessing;
   Application.ProcessMessages; { Requires Uses Forms }
until Aborted or Finished;

John.

Other Threads