Autor Beitrag
Cookie007
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Di 31.10.06 17:55 
Problem :
Die markierte if- then -else Struktur wird nicht beachtet
ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
 X := StrToInt(edit1.text);

   if X > 255 then      // die hier
   begin 
   shape1.Brush.Color := clyellow;
   shape2.Brush.Color := clyellow;
   shape3.Brush.Color := clyellow;
   shape4.Brush.Color := clyellow;
   shape5.Brush.Color := clyellow;
   shape6.Brush.Color := clyellow;
   shape7.Brush.Color := clyellow;
   shape8.Brush.Color := clyellow;
   end

   else    //die hier
   shape1.Brush.Color := clgray;
   shape2.Brush.Color := clgray;
   shape3.Brush.Color := clgray;
   shape4.Brush.Color := clgray;
   shape5.Brush.Color := clgray;
   shape6.Brush.Color := clgray;
   shape7.Brush.Color := clgray;
   shape8.Brush.Color := clgray;

   if X < 256 then
   Y := X mod 2;
   X:= X div 2;
   if Y > 0 then Shape1.Brush.Color := clyellow
   else shape1.Brush.color := clgray;

   Y := X mod 2;
   X:= X div 2;
   if Y > 0 then Shape2.brush.color := clyellow
   else shape2.Brush.color := clgray;

   Y := X mod 2;
   X:= X div 2;
   if Y > 0 then Shape3.Brush.color := clyellow
   else shape3.Brush.color := clgray;

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 31.10.06 17:57 
Moin!

Du hast das begin-end um den else-Fall vergessen. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
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: Di 31.10.06 19:53 
Achte bitte auf korrekte Formatierung, dadurch kommt es seltener zu solchen Problemen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
if X = Y then
begin
  A := B;
  C := D;
end
else
begin
  B := A;
  D := C;
end;

if X = Y then
  A := B
else
  B := A;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Y := X mod 2;  
X := X div 2;  

if Y > 0 then
  Shape2.Brush.color := clYellow  
else
  Shape2.Brush.color := clGray;

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