![]() |
Re: Variabeln Problem!
Zitat:
Zitat:
Ich hätte das jetzt auf die schnelle so gemacht:
Delphi-Quellcode:
type
TForm1 = class(TForm) btn_Schalten: TButton; SRot: TShape; SGelb: TShape; SGruen: TShape; procedure FormCreate(Sender: TObject); procedure btn_SchaltenClick(Sender: TObject); private { Private-Deklarationen } VSchalten: integer; procedure FormInit; procedure UpDateAmpel; public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn_SchaltenClick(Sender: TObject); begin Inc(VSchalten); UpDateAmpel; end; procedure TForm1.FormInit; begin VSchalten := 0; end; procedure TForm1.FormCreate(Sender: TObject); begin FormInit; UpDateAmpel; end; procedure TForm1.UpDateAmpel; begin if (VSchalten = 4) then begin VSchalten := 0; end; case VSchalten of 0: begin SRot.Brush.Color := clred; SGelb.Brush.Color := clblack; SGruen.Brush.Color := clblack; end; 1: begin SRot.Brush.Color := clred; SGelb.Brush.Color := clyellow; SGruen.Brush.Color := clblack; end; 2: begin SRot.Brush.Color := clblack; SGelb.Brush.Color := clblack; SGruen.Brush.Color := clgreen; end; 3: begin SRot.Brush.Color := clblack; SGelb.Brush.Color := clyellow; SGruen.Brush.Color := clblack; end; end; end; |
Re: Variabeln Problem!
Zitat:
Wobei das mit dem Case auch wieder besser ist ;) Klugscheißen Ende... |
Re: Variabeln Problem!
Nunja, ich mache das nicht aus "Spaß" sondern, weil mein Lehrer mir das so aufgetragen hat. Und da kann es mir egal sein, warum er das verlangt, Tatsache ist dass er es in der nächsten Stunde sehen will ;) *gogo Info LK*. Hab eigentlich mit der Theorie weniger Probleme, nur ist Delphi doch in manchen Sachen anders als ich es bisher von zB PHP kannte ;)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz