| View previous topic :: View next topic |
| Author |
Message |
ross-mcm Guest
|
Posted: Fri Feb 02, 2007 9:12 am Post subject: Waiting for a thread to complete before starting a modal dia |
|
|
I have an app where data is read from a serial device and is used to
populate controls on a Modal dialog. The serial data is read in a
thread to prevent the main app freezing but how do I wait until the
thread is finished before opening the dialog?. Is it OK to have:
start thread to read data
repeat
Application.ProcessMessages ;
until thread completed
Dialog.ShowModal
Is there a more elegant way? |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 02, 2007 11:57 pm Post subject: Re: Waiting for a thread to complete before starting a modal |
|
|
Hi!
I recommend using
Thread1.WaitFor
WaitFor doesn't return until the other thread terminates, either by
finishing its own Execute method or by terminating due to an
exception.
ross-mcm írta:
| Quote: | I have an app where data is read from a serial device and is used to
populate controls on a Modal dialog. The serial data is read in a
thread to prevent the main app freezing but how do I wait until the
thread is finished before opening the dialog?. Is it OK to have:
start thread to read data
repeat
Application.ProcessMessages ;
until thread completed
Dialog.ShowModal
Is there a more elegant way? |
|
|
| Back to top |
|
 |
|