Einzelnen Beitrag anzeigen

Benutzerbild von jfheins
jfheins

Registriert seit: 10. Jun 2004
Ort: Garching (TUM)
4.579 Beiträge
 
#9

Re: Verschachtelte iflcauses

  Alt 30. Sep 2004, 19:12
Fehler gefunden !!!

Delphi-Quellcode:
if s_rot.Brush.Color = clred then // trifft auch bei rot/gelb zu !!!!!
begin
  s_gelb.Brush.Color :=clyellow;
end
else // trifft nur bei gelb zu, bei rot/gelb wird's übersprungen !!!
begin
  if s_gelb.brush.color =clyellow then
  begin
    s_rot.Brush.Color :=clwhite;
    s_gelb.Brush.Color :=clwhite;
    s_gruen.brush.color :=clgreen;
  end
  else
  begin
    if s_gruen.brush.color =clgreen then
    begin
      s_gruen.Brush.Color :=clwhite;
      s_gelb.Brush.Color :=clyellow;
    end
    else
    begin
     s_gelb.Brush.color :=clwhite;
     s_rot.brush.color :=clred
    end;
  end;
end;
Lösung auch gefunden:
Delphi-Quellcode:
procedure Tf_ampel.b_goClick(Sender: TObject);
begin
if (s_rot.Brush.Color = clred) AND (s_gelb.Brush.Color = clwhite) then
begin
  s_gelb.Brush.Color := clyellow;
end
else
begin
  if (s_rot.Brush.Color = clred) AND (s_gelb.brush.color = clyellow) then
  begin
    s_rot.Brush.Color := clwhite;
    s_gelb.Brush.Color := clwhite;
    s_gruen.brush.color := clgreen;
  end
  else
  begin
    if s_gelb.brush.color := clyellow then
    begin
      s_rot.Brush.Color := clred;
      s_gelb.Brush.Color := clwhite;
      s_gruen.brush.color := clwhite;
    end
    else
    begin
      if s_gruen.brush.color = clgreen then
      begin
        s_gruen.Brush.Color := clwhite;
        s_gelb.Brush.Color := clyellow;
      end
      else
      begin
       s_gelb.Brush.color := clwhite;
       s_rot.brush.color := clred
      end;
    end;
  end;
end;

end;
Ich weis, ich bin gemein. (Bevor du den Fehler postest, schau dir den Code nochmal an ... )
  Mit Zitat antworten Zitat