unit ampel;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Shape1: TShape;
sh_red: TShape;
sh_yellow: TShape;
sh_green: TShape;
switch: TButton;
procedure switchClick(Sender: TObject);
private
{ Private-Deklarationen}
public
{ Public-Deklarationen}
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Procedure wait(Time:Integer);
Var x:Dword;
Begin
Time := Time * 20;
x := GetTickCount ;
While x - time < GetTickCount
do Application.ProcessMessages;
End;
procedure TForm1.switchClick(Sender: TObject);
begin
wait(3);
sh_green.Visible := false;
sh_yellow.Visible := true;
wait(3);
sh_yellow.Visible := false;
sh_red.Visible := true;
wait(3);
sh_yellow.Visible := true;
wait(3);
sh_red.Visible := false;
sh_yellow.Visible := false;
sh_green.Visible := true;
end;
end.