unit mCounter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, mmsystem;
type
TCounter1 =
class(TForm)
EdStunden: TEdit;
Button1: TButton;
LbAufgabe: TLabel;
EdMinuten: TEdit;
TiCounter: TTimer;
LbStundenMinuten: TLabel;
LbCounterSt: TLabel;
LbCounterMin: TLabel;
procedure Button1Click(Sender: TObject);
procedure TiCounterTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Counter1: TCounter1;
Minuten, Stunden, Counter: real;
implementation
{$R *.dfm}
procedure TCounter1.Button1Click(Sender: TObject);
begin
Stunden := StrToFloat(EdStunden.Text);
Minuten := StrToFloat(EdMinuten.Text);
EdStunden.Color := clMedGray;
EdMinuten.color := clMedGray;
LbCounterSt.Visible := true;
LbCounterMin.Visible := true;
TiCounter.Enabled := true;
EdStunden.
ReadOnly := true;
EdStunden.
ReadOnly := true;
end;
procedure TCounter1.TiCounterTimer(Sender: TObject);
begin
If EdStunden.Text = '
'
then EdStunden.Text := '
0';
If (Minuten = 0)
and (Stunden > 0)
then begin
Minuten := 60;
Stunden := Stunden -1;
end;
If (Stunden = 0)
and (Minuten = 0)
then begin
TiCounter.enabled := false;
sndPlaySound(PChar('
C:\WINDOWS\Media\SystemStart.wav'),SND_ASYNC)
end
else Minuten := Minuten -1;
LbCounterSt.Caption := FloatToStr (Stunden);
LbCounterMin.Caption := FloatToStr (Minuten);
end;
end.