unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;
type
{ TForm1 }
TForm1 =
class(TForm)
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
Phase: Integer;
Zeit: Integer;
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Panel1.Color := clMaroon;
Panel2.Color := clOlive;
Panel3.Color := clGreen;
Panel1.Caption:='
';
Panel2.Caption:='
';
Panel3.Caption:='
';
Button1.Caption:='
Start';
Phase:=1;
Zeit:=1;
Timer1Timer.Enabled:=false;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
case Phase
of
1:
begin
Panel1.Color := clRed;
Panel2.Color := clOlive;
Panel3.Color := clGreen;
Phase:= Phase + 1;
end;
2:
begin
Panel1.Color := clMaroon;
Panel2.Color := clYellow;
Panel3.Color := clGreen;
Phase:= Phase + 1;
end;
3:
begin
Panel1.Color := clMaroon;
Panel2.Color := clOlive;
Panel3.Color := clLime;
Phase:= Phase + 1;
end;
4:
begin
Panel1.Color := clMaroon;
Panel2.Color := clYellow;
Panel3.Color := clGreen;
Phase:= 1;
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
begin
Zeit:= Zeit + 1;
case Zeit
of
1..5 : Phase:= 1;
6 : Phase:= 2;
7..11: Phase:= 3;
12 :
begin
Phase:= 4;
Zeit:= 0;
end;
end;
end;
Button1Click(
NIL);
end;
end.