BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Waiting for a thread to complete before starting a modal dia

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal
View previous topic :: View next topic  
Author Message
ross-mcm
Guest





PostPosted: Fri Feb 02, 2007 9:12 am    Post subject: Waiting for a thread to complete before starting a modal dia Reply with 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
Guest






PostPosted: Fri Mar 02, 2007 11:57 pm    Post subject: Re: Waiting for a thread to complete before starting a modal Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.