Autor Beitrag
Michael15
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 14:54 
Hallo Alle Zusammen

Unser Informatik Prof hat uns den Auftrag gegeben wir sollen ein Program,m schreiben mit 4 Buttons und einem leeren Edit Feld.

Button1: Rotkäppchen
Button2: Wolf
Button3: Stop (Ausgangssituatin)
Button4: Halt (Programm schließen)

Es muss erreicht weren:

Wenn man auf rotkäppchen klickt dann, erscheinz ein bestimmter Text im Edit Feld.
Wenn man dann auf Wolf klickt wird dieser wieder gelöscht und dann erscheint ein anderer bestimmter text im Edit Feld. Diese Reihe soll dann fortgesetzt werden.
Könnt ihr mir bitte helfen???

Danke
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 18.02.05 15:00 
Das kann doch nur ein Scherz sein oder?

_________________
Ciao, Sprint.
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 15:02 
Nein, das ist kein Scherz, das ist die zweite Woche, die wir Informatik haben.
Und ich kann leider noch nicht so viel.
Ich bitte trotzdem um Hilfe.
Quivadis
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Fr 18.02.05 15:05 
Das klingt doch einfach, wenn du nicht vergessen hast was hinzuschreiben.

Du legst auf deine Form 4 Buttons und ein editfeld.

Dann machst du einen Doppelklick auf den ersten Button. Delphi erzeugt ein onclick ereigniss. In dieses schreibst du nun:
ausblenden Delphi-Quelltext
1:
edit1.test:=' hier kommt dein text';					


dasselbe machst du nun auch noch für die 3 anderen Buttons.

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 18.02.05 15:06 
Du brauchst doch nur im ObjektInspektor deinen Button ein Ereignis zuweisen oder doppelklick auf den Button. In die Prozedur/Methode schreibst du dann Edit1.Text := 'Mein Text'.

_________________
Ciao, Sprint.
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 15:07 
Das Problem ist nur, dass die Reihe fortgesetzt werden soll.

Rotkäppchen : Hallo
Wolf: Hallo2
Rotkäppchen: Hallo3
Wolf .Hallo4

und bei mir sucht delphi sich immer eine "rede aus"

Was muss ich da machen???
der_zaehe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 317

WinXP SP2
D6 Pers, D2005 Prof, VS2005
BeitragVerfasst: Fr 18.02.05 15:10 
nimm eine variable, die hochgezählt und dann überprüft wird.
Je nach dem, welchen Wert sie hat, gib dann den entsprechenden teil des dialogs aus

_________________
[inspirationslos]
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 15:11 
wie geht das mit der Variable, oder könnt ihr mir einen kurzen Quelltext schreiben???
Danke für die Hilfe
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 18.02.05 15:17 
Du deklarierst eine Variable z.B. so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  TForm1 = class(TForm)
  ...
  private
    { Private-Deklarationen }
    Zaehler: Integer;
  ...
  end;


Und erhöchst diese Variable immer um einen mit Inc(Zaehler). In deiner ButtonClick Methode wandelst du die Zahl mit IntToStr um.

_________________
Ciao, Sprint.
der_zaehe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 317

WinXP SP2
D6 Pers, D2005 Prof, VS2005
BeitragVerfasst: Fr 18.02.05 15:18 
aalso:
das könnte zum Beispiel so aussehen:
variable deklarieren, wie oben beschrieben,
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Zaehler := Zaehler+1;
  if Zaehler = 1 then
    //Dialogtext 1
  if Zaehler = 2 then
    //Dialogtext 2
  if Zaehler = 3 then
    //Dialogtext 3

  ...

end;

end.

_________________
[inspirationslos]


Zuletzt bearbeitet von der_zaehe am Fr 18.02.05 15:19, insgesamt 1-mal bearbeitet
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 15:19 
Danke rstmal, das werde ich jetzt mal ausprobieren.
Wenn ich noch fragen habe melde ich mich.
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 15:27 
Könnt ihr bei //Dialogtext vielleicht weiterschreiben, weil das kapier ich noch nicht.
Danke
der_zaehe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 317

WinXP SP2
D6 Pers, D2005 Prof, VS2005
BeitragVerfasst: Fr 18.02.05 15:38 
bei //dialogtext schreibst du dann z.B.

Quivadis hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
edit1.text:=' hier kommt dein text';					


_________________
[inspirationslos]
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 16:10 
Bis hierhin geht alles,
Und was mache ich dann am ende, damit sich diese Reihenfolge wiederholt???
der_zaehe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 317

WinXP SP2
D6 Pers, D2005 Prof, VS2005
BeitragVerfasst: Fr 18.02.05 16:27 
ausblenden Delphi-Quelltext
1:
2:
if Zaehler = (Länge des Dialogs) then
  Zaehler := 0;

_________________
[inspirationslos]
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Fr 18.02.05 20:09 
Danke an alle, die mir geholfen haben.
Thankz
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 18.02.05 20:35 
Zitat:
Rotkäppchen : Hallo
Wolf: Hallo2
Rotkäppchen: Hallo3
Wolf .Hallo4


Wäre dann aber so einfacher:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
// in der Wolf-Procedure
Edit1.Text := 'Wolf: Hallo' + IntToStr(Zaehler);
inc(Zaehler);

// in der Rotk.-Procedure
Edit1.Text := 'Rotk.: Hallo' + IntToStr(Zaehler);
inc(Zaehler);

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)