Autor Beitrag
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Mi 10.10.07 09:28 
Hey,

sry schoneinmal für die schlechte Wahl des Titles aber mit ist echt nichts bessres eingefallen.

Hier das Problem bei dem folgenden Code :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer ;
begin
    for i := 0 to 10 do
      begin
        Label1.caption := IntToStr(i);
        application.ProcessMessages;
        sleep(60);
end;
    begin
     IntToStr((StrToInt(label1.caption)));
     if (i >= 1 ) and (i <= 10then
      begin
        case farbe of
          1 : begin
            Form1.Color := clRed ;
                end;
          2 : begin
            Form1.Color := ClBlue ;
                end;

end;

end.


Meiner Meinung nach liegt das Problem im zweiten Teil, ich weiß nur nicht wo weil er mir nur asgt, das ein "Record, Objekt oder Klassentyp" erforderlich sei.
Sry, aber als Anfänger weiß ich hier nichht weiter :(

Grüße

GericasS

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 10.10.07 09:39 
(a) schau die mal Zeile 12 an
(b) zwei Zeichen Einrückung reichen
(c) end unter begin

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 10.10.07 09:46 
Ich sag mal so: Der Code ist kreativ. ;-)

Was willst du denn erreichen?

_________________
We are, we were and will not be.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 10.10.07 09:48 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.Button1Click(Sender: TObject);
var
  i : Integer ;
  farbe : integer; // fehlte
begin
  for i := 0 to 10 do
  begin
    Label1.caption := IntToStr(i);
    application.ProcessMessages;
    sleep(60);
  end;

// ein begin gelöscht
  farbe := StrToInt(label1.caption); //irgendwohin muss das Ergebnis zugewiesen werden
  if (i >= 1 ) and (i <= 10then
  begin
    case farbe of
      1 : Form1.Color := clRed ;
      2 : Form1.Color := ClBlue ;
    end;
  end// fehlte

end.

- Richtig einrücken spart die Fehlersuche
- Einrückungen üblicherweise 2 Zeichen
- Ich habe es mal so gemacht, wie ich es mir angewöhnt habe

Eigentlich willst Du doch, dass die Farbe jede Sekunde geändert wird, oder? Dann sollte der untere Block eigentlich auch in der Schleife stehen und nicht darunter. :wink:


Zuletzt bearbeitet von jasocul am Mi 10.10.07 10:03, insgesamt 2-mal bearbeitet
GericasS Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Mi 10.10.07 09:48 
user profile iconGausi hat folgendes geschrieben:
Ich sag mal so: Der Code ist kreativ. ;-)

Was willst du denn erreichen?


Also,

eigentlich soll gar nicht so viel geschehen, nur immer wenn das label was ausgibt ( eine zahl ) soll die Farbe sich ändern. Ich hoffe das der Code überhaupt im Ansatz richtig ist.

@jasocul : Die var. farbe war global deklariert ! Aber ich danke dir für die Hilfe !

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300