unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Spin, StdCtrls, ComCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
eingabe: TEdit;
start: TButton;
schliessen: TButton;
ausgabe: TLabel;
fortschritt: TProgressBar;
Label1: TLabel;
Label2: TLabel;
systime: TEdit;
userzeit: TEdit;
Label3: TLabel;
Label4: TLabel;
Timer1: TTimer;
stop: TButton;
start1: TButton;
Label5: TLabel;
procedure startClick(Sender: TObject);
procedure schliessenClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure stopClick(Sender: TObject);
procedure start1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x,i :longint;
implementation
{$R *.dfm}
procedure TForm1.startClick(Sender: TObject);
Procedure pause(t : longint);
Var start : longint;
Begin
Start:= gettickcount;
While gettickcount < start+t
do
Application.processmessages
end;
begin
x:=strtoint(eingabe.text);
i:=x;
For i:=x
downto 0
do
begin
ausgabe.caption:=inttostr(i);
fortschritt.position:=trunc((x-i)*(100/x)) ;
pause(1000);
end;
end;
procedure TForm1.schliessenClick(Sender: TObject);
begin
close;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
systime.Text := TimeToStr(Now);
if DateTimeToTimeStamp(StrToTime(userzeit.Text)).Time = DateTimeToTimeStamp(StrToTime(systime.Text)).Time
then startClick(start);
end;
procedure TForm1.stopClick(Sender: TObject);
begin
timer1.enabled:=false;
end;
procedure TForm1.start1Click(Sender: TObject);
begin
timer1.Enabled:=true;
end;
end.