unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, mmsystem,
ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Button3: TButton;
Button4: TButton;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
Stunden, Minuten, Sekunden: integer;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.enabled:=not timer1.enabled;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
SSekunden, SMinuten, SStunden:
string;
begin
if not (sender=button2)
then Sekunden:=Sekunden-1;
if Sekunden=0
then begin
sekunden:=60;
Minuten:=Minuten-1;
If Minuten=0
then begin
Stunden:=Stunden-1;
Minuten:=60;
end;
SSekunden:=inttostr(Sekunden);
SMinuten:=inttostr(Minuten);
SStunden:=inttostr(Stunden);
if Length(SSekunden)=1
then
SSekunden:='
0'+SSekunden;
if Length(SMinuten)=1
then
SMinuten:='
0'+SMinuten;
If Length(SStunden)=1
then
SStunden:='
0'+SStunden;
Label1.caption:=SStunden+'
:'+SMinuten+'
:'+SSekunden;
if Sekunden = 0
then begin
Label2.Caption:= '
test';
sndPlaySound(PChar('
E:\Music\Monsterkill.wav'),SND_ASYNC);
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
Var Stcounter, Skcounter, Mcounter:
string;
begin
Stcounter:= Unit2.Form2.Edit1.Text;
Mcounter:= Unit2.Form2.Edit2.Text;
Skcounter:= Unit2.Form2.Edit3.Text;
if (Stcounter = '
0')
and (Mcounter = '
0')
and (Skcounter = '
0')
then begin
Stunden:=0;
Minuten:=0;
Sekunden:=0;
end
else if (Stcounter > '
0')
and (Mcounter = '
0')
and (Skcounter = '
0')
then begin
Stunden:=StrToInt(Stcounter);
Minuten:=0;
Sekunden:=0;
end;
if (Stcounter > '
0')
and (Mcounter > '
0')
and (Skcounter = '
0')
then begin
Stunden:=StrToInt(Stcounter);
Minuten:=StrToInt(Mcounter);
Sekunden:=0;
end;
if (Stcounter > '
0')
and (Mcounter > '
0')
and (Skcounter > '
0')
then begin
Stunden:=StrToInt(Stcounter);
Minuten:=StrToInt(Mcounter);
Sekunden:=StrToInt(Skcounter);
end;
if (Stcounter = '
0')
and (Mcounter > '
0')
and (Skcounter > '
0')
then begin
Stunden:= 0;
Minuten:=StrToInt(Mcounter);
Sekunden:=StrToInt(Skcounter);
end;
if (Stcounter = '
0')
and (Mcounter = '
0')
and (Skcounter > '
0')
then begin
Stunden:= 0;
Minuten:= 0;
Sekunden:=StrToInt(Skcounter);
end;
if (Stcounter > '
0')
and (Mcounter = '
0')
and (Skcounter > '
0')
then begin
Stunden:=StrToInt(Stcounter);
Minuten:=0;
Sekunden:=StrToInt(Skcounter);
end;
//if (stcounter='0') and (mcounter = '0') and (skcounter='0') then begin
// Form1.Label3.Caption:= 'Bitte zeit eingeben oder auf neu klicken' ;
//end;
timer1.enabled:=false;
timer1timer(sender);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Form2.Visible:= true;
end;
end.