TIP: Click on subject to list as thread! ANSI
echo: delphi
to: JORGEN DE GIER
from: STEVE BATSON
date: 1996-10-08 08:20:00
subject: releasing timeslice

JG> I have a program with a loop inside. Within that loop each record in 
JG> a TTableis checked. During that loop I show the progress via the 
JG> TGauge component.
JG> During that loop the whole system stops. How do I release a timeslice 
JG> so that any other programs can continue?
JG> Now it's even imposible to provide an Abort button.
JG> Form2.Gauge1.MinValue := 0;
JG> Form2.Gauge1.MaxValue := Table1.RecordCount;
JG> { Form2.fsStyle := sfStayOnTop }
JG> Form2.Show;
JG> Table1.First;
JG> while not Table1.EOF do
JG> begin
JG>    if Table1.FieldByName( 'FIELD1' ).AsString = 'gotcha' then
JG>    begin
JG>        dosomething;
JG>    end;
JG>    Form2.Gauge1.AddProgress( 1 );
JG>    { release timeslice }
JG>    Table1.Next; { forget this one and Win95/3.1 will crash terrible 
JG> !! }end;
JG> Form2.Close;
JG> Toedeloe,
Try putting the following line in your loop: 
Application.ProcessMessages; 
Hope that helps. 
Steve
--- FreeMail 1.07b
(1:203/21)
---------------
* Origin: The Visual Programmer's Workshop - N.H., Ca (916)338-3230 *

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.