Einzelnen Beitrag anzeigen

manialf

Registriert seit: 23. Sep 2006
3 Beiträge
 
#1

Ordinaltyp bei case of

  Alt 23. Sep 2006, 18:28
Hallo,

ich habe jetzt seit 2 Wochen Info und wir sollen eine Ampel programmieren. ich bin jetzt soweit:
Problem: In der zeile case zustand of kommt die Meldung Ordinaltyp benötigt. keine Ahnung wie das geht. Hoffe auf eure Hilfe...

Delphi-Quellcode:
implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
halt;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

w:= 390;
h:= 510;

setbounds((screen.Width-w)div 2,(screen.Height-h)div 2,w,h)

end;

procedure TForm1.Button1Click(Sender: TObject);
begin

case 'zustandof

1: begin
   Sh_red.Brush.Color :=clRed;
   Sh_yellow.Brush.Color :=clWhite;
   Sh_lime.Brush.Color:=clWhite;
    end;

2: begin
   Sh_red.Brush.Color :=clRed;
   Sh_yellow.Brush.Color :=clYellow;
   Sh_lime.Brush.Color:=clWhite;
    end;

3: begin
   Sh_red.Brush.Color :=clWhite;
   Sh_yellow.Brush.Color :=clWhite;
   Sh_lime.Brush.Color:=clLime;
    end;

4: begin
   Sh_red.Brush.Color :=clWhite;
   Sh_yellow.Brush.Color :=clYellow;
   Sh_lime.Brush.Color:=clLime;
    end;

end;

if zustand >4 then zustand := 1;

end;

end.
  Mit Zitat antworten Zitat