Does any one know how to implement an equivalent to the DELAY procedure
in Borland Pascal? The TTimer won't do since it does not pause
code execution and using DecodeTime to calculate time intervals is very
difficult due to the cyclic nature of time (0-59 min, o-59 sec, ectc.).
I would appreciate suggestions...Thanks in advance.
I have used a Timer component and the followings to solve the problem:
1) add a boolean variable TimOk to your form
2) add a Timer component to your form
procedure Form1.TimeDelay(Delay: Integer);
begin
TimeOK := False;
Timer1.Enabled := False;
Timer1.Interval := Delay;
Timer1.Enabled := True;
repeat
Application.ProcessMessages;
until TimeOK;
end;
then in your Timer's timer event, write:
Form1.Timer1Timer(Sender: TObject);
begin
TimeOK := True;
end;
then when you need to delay in your program, just call TimeDelay with how
long you wish to delay as it's parameter.
Best Rgds, _
I
I__esLie_.
[stuff deleted]
Hallo,
what about this (rather obscene) way to delay:
USES ...., SysUtils, ...;
CONST Second=1.0/(24.0*3600.0);
Any := 5; {any figure you want}
StartTime := Now;
repeat Application.ProcessMessages until ((Now-StartTime)>Any*Second);
Tschuess Wolfgang
--
--------------------------------------------------------------------------
Dr. W. Gross, Abt. f. Exp. Chirurgie, Uniklinik Heidelberg, Germany
Wolfgan...@exchi.uni-heidelberg.de
You could set a timer, and when it goes off it could continue the
process.....
--
Al Lipscomb | 1-800-HIT-HOME | Systems Programmer
a...@intnet.net | Help not Hassle. | All opinions are
St. Pete, FL | Youth Development Int. | my own.
Nice, but you forgot to taken into account the Stroke of Midnight
(86400 seconds).
That is (depending on implementation):
if Now - StartTime < 0 do
or
if StartTime + Any > 86400 do
-- Suresh