![]() |
Brauche Hilfe bei Delphi 5 Ampelsystem
Hallo zusammen,
Es handelt sich um Delphi 5!!! ich habe hier eine Ampelkreuzung mit 4 Ampeln dies klappt soweit. Ich bitte um eure hilfe, dass ihr mir sagt wie ich autos hinbekomme und die rote und grüne ampelzeit länger hält. :wiejetzt: Bitte beachtet das ich anfänger bin!! Unten mein Quelltext:
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Shape1: TShape; Shape2: TShape; shpRed1: TShape; shpYellow1: TShape; shpGreen1: TShape; shpYellow2: TShape; shpRed2: TShape; shpGreen2: TShape; Shape9: TShape; Shape10: TShape; Shape11: TShape; Shape12: TShape; Shape13: TShape; Shape14: TShape; Shape15: TShape; Shape16: TShape; Shape17: TShape; Shape18: TShape; Shape19: TShape; Shape20: TShape; Shape21: TShape; Shape22: TShape; Shape23: TShape; Shape24: TShape; Shape25: TShape; Shape26: TShape; Shape27: TShape; Shape28: TShape; Shape29: TShape; Shape30: TShape; Shape32: TShape; Shape33: TShape; Shape34: TShape; Shape35: TShape; Shape36: TShape; Shape37: TShape; Shape38: TShape; Shape39: TShape; Shape31: TShape; Shape40: TShape; Shape41: TShape; Shape42: TShape; Shape43: TShape; Shape44: TShape; Shape45: TShape; Shape46: TShape; Shape47: TShape; Shape48: TShape; Shape49: TShape; Shape50: TShape; Shape51: TShape; Shape52: TShape; Shape53: TShape; Shape54: TShape; Shape55: TShape; Shape56: TShape; Shape57: TShape; Shape59: TShape; Shape60: TShape; Shape61: TShape; Shape62: TShape; Shape63: TShape; Shape64: TShape; Shape65: TShape; Shape66: TShape; Shape67: TShape; Shape68: TShape; Button1: TButton; Timer1: TTimer; shpRed4: TShape; shpYellow4: TShape; shpGreen4: TShape; shpRed3: TShape; shpYellow3: TShape; shpGreen3: TShape; Timer2: TTimer; Button2: TButton; procedure shpRed2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Timer1Timer(Sender: TObject); procedure Timer2Timer(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.shpRed2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin Close; end; procedure TForm1.Timer1Timer(Sender: TObject); begin if shpGreen2.Brush.Color = clblack then begin Timer1.interval := 2000; shpRed2.Brush.Color := clred; shpYellow2.Brush.Color := clblack; shpGreen2.Brush.Color := clnone; shpRed1.Brush.Color := clred; shpYellow1.Brush.Color := clblack; shpGreen1.Brush.Color := clnone; end else if shpYellow2.Brush.Color = clblack then begin Timer1.interval := 2000; shpRed2.Brush.Color := clred; shpYellow2.Brush.Color := clyellow; shpGreen2.Brush.Color := clnone; shpRed1.Brush.Color := clred; shpYellow1.Brush.Color := clyellow; shpGreen1.Brush.Color := clnone; end else if shpRed2.Brush.Color = clred then begin Timer1.interval := 2000; shpRed2.Brush.Color := clnone; shpYellow2.Brush.Color := clnone; shpGreen2.Brush.Color := cllime; shpRed1.Brush.Color := clnone; shpYellow1.Brush.Color := clnone; shpGreen1.Brush.Color := cllime; end else if shpGreen2.Brush.Color = cllime then begin Timer1.interval := 2000; shpRed2.Brush.Color := clblack; shpYellow2.Brush.Color := clyellow; shpGreen2.Brush.Color := clblack; shpRed1.Brush.Color := clblack; shpYellow1.Brush.Color := clyellow; shpGreen1.Brush.Color := clblack; end end; procedure TForm1.Timer2Timer(Sender: TObject); begin if shpGreen4.Brush.Color = clblack then begin Timer2.interval := 2000; shpRed4.Brush.Color := clred; shpYellow4.Brush.Color := clblack; shpGreen4.Brush.Color := clnone; shpRed3.Brush.Color := clred; shpYellow3.Brush.Color := clblack; shpGreen3.Brush.Color := clnone; end else if shpYellow4.Brush.Color = clblack then begin Timer2.interval := 2000; shpRed4.Brush.Color := clred; shpYellow4.Brush.Color := clyellow; shpGreen4.Brush.Color := clnone; shpRed3.Brush.Color := clred; shpYellow3.Brush.Color := clyellow; shpGreen3.Brush.Color := clnone; end else if shpRed4.Brush.Color = clred then begin Timer2.interval := 2000; shpRed4.Brush.Color := clnone; shpYellow4.Brush.Color := clnone; shpGreen4.Brush.Color := cllime; shpRed3.Brush.Color := clnone; shpYellow3.Brush.Color := clnone; shpGreen3.Brush.Color := cllime; end else if shpGreen4.Brush.Color = cllime then begin Timer2.interval := 2000; shpRed4.Brush.Color := clblack; shpYellow4.Brush.Color := clyellow; shpGreen4.Brush.Color := clblack; shpRed3.Brush.Color := clblack; shpYellow3.Brush.Color := clyellow; shpGreen3.Brush.Color := clblack; end end; procedure TForm1.Button2Click(Sender: TObject); begin end; end. |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Zitat:
Sind die Timer von anfang an Enabled? Was hast du mit dem leeren Button vor? Zitat:
Da die Shapes, also die Ampelphasen über die Timer gesteuert werden, einfach den Timer Intervall erhöhen für längere Phasen. Aber dieses Modell findest du mehrfach hier im Forum. Hast du die Suche benutzt? Wenn nicht, warum nicht? Gruß |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Hi
Auch auf die Gefahr hin, das ich hier wiederhole... dies ist kein Forum : "Wer macht meine Hausaufgaben". Zuerst Hilfe bei Google - Delphi Ampel sollte einige brauchbare Tipps liefern Auch hier in der DP gibt es die Suchen-Funktion für Ampel. Da bin ich mir sicher, da ist genug Material vorhanden, da du nicht der erste mit dieser Hausaufgabe bist. Und letztlich.... Das was du an "Programmcode" bezeichnest, ist nichts ! Da solltest du vielleicht doch mal ein paar Minuten opfern und eigen Gedanken einfließen lassen. Und wenn's dann ein bestimmtes Problem zu beheben gibt, dann wirst du hier sicher auch Hilfe bekommen. Gruß oldmax |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Zitat:
Super NEtt!!! Tausen DANK!!! Homer! |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Zitat:
1.) Ein Thread - eine Frage. Das erste wäre also die Verlängerung der Phasen. Das machst Du, in dem Du das Timerintervall erhöhst. Diese wäre beantwortet. 2.) Für die zweite Frage: überlege Dir vorher was Du genau machen willst, fange an das zu Programmieren. Wenn etwas überhaupt nicht klappt benutze die Suche um Hilfe zu bekommen. Erst wenn das alles nicht klappt, dann frage hier erneut nach - mit einem konkreten Problem und Dir wird mit Tipps in die Richtung (nicht mit Code!) geholfen. Genau so funktioniert die DP, und daran hat sich hier jeder zu halten. |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Hallo,
ich würde dir empfehlen, lass doch die blanks weg in deinem Text dann wird er noch unleserlicher. Zitat:
Dies ist doch eine Zumutung was du so zusammenschreibst! Viele Grüsse! |
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
Bitte nicht offtopic werden. Danke.
|
Re: Brauche Hilfe bei Delphi 5 Ampelsystem
in Konsole cl_flame 0 plz
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:47 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