Hi @ all!!
Ich steh grad auf dem schlauch und komm nicht mehr weiter
Allgemein:
Delphi-Quelltext
1: 2:
| if (Bedingung1)= Wert1 or if (Bedingung2) ... Wert1 then ... |
bei mir funktioniert das mit meinem Code jedoch nicht:
Zur Procedure: Figur1 soll auf ein ShapeX gehen, das die selbe Tagnummer hat
(Vorher wird noch eine Zahl gewürfelt und zur Tagnummer der Figur 1 addiert
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.Figur1DblClick(Sender: TObject); var x: Integer; begin for x := 1 to 20 do begin if Figur1.tag = TShape(FindComponent('Shape'+inttostr(x))).tag) then begin
if (Figur2.tag <> TShape(FindComponent('Shape'+inttostr(x))).tag ) or if (Figur3.tag <> TShape(FindComponent('Shape'+inttostr(x))).tag ) then begin Figur1.top := TShape(FindComponent('Shape'+inttostr(x))).top; Figur1.left := TShape(FindComponent('Shape'+inttostr(x))).left; break end else if Figur2.tag or Figur3.tag = TShape(FindComponent('Shape'+inttostr(x))).tag then ...
end; end; end; |
Die if-Anweisung funktioniert nur, wenn ich schreibe:
Delphi-Quelltext
1:
| if Figur2.tag <> TShape(FindComponent('Shape'+inttostr(x))).tag ) |
wenn ich das gleichzeitig mit der Figur 3 machen will, geht das nicht; WIESO???
(kann man die "else if-Anweisung" auch so schreiben, dass abgefragt wird ob zwei Figuren die Nummer haben ??)
Danke im Vorraus
Chris
Moderiert von
Gausi: Code- durch Delphi-Tags ersetzt