Autor Beitrag
marcon01
Hält's aus hier
Beiträge: 11



BeitragVerfasst: Mi 09.11.11 17:16 
Hallo zusammen,

mein Tic Tac Toe ist soweit fertig allerdings mit einem nicht ganz unwichtigem Problem.

Und zwar will ich natürlich über mein Label ausgegeben haben wer gewonnen hat.
Zum Beispiel: "X hat gewonnen" oder so etwas.

Aber ich bekomme immer die Error-Meldung:"Operator not applicable to this operand type."

Meine if-Abfrage lautet wie folgt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
  if Button1.Caption := 'X' and Button2.Caption := 'X' and Button3.Caption := 'X' then
     Label2.Caption := ('X WINS');
end;

hoffe ihr könnt mir helfen
Danke^^

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Mi 09.11.2011 um 16:33
Moderiert von user profile iconNarses: Titel geändert, war: "Tic Tac Toe bitte um Hilfe".
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mi 09.11.11 17:24 
Und du hast das selbst geschrieben? ^^
Man vergleicht mit "=" und es gehört eine Klammer um den Block. "if (....) then"
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 09.11.11 17:31 
Um das mit den Klammern nochmal klarzustellen: So ists richtig:
ausblenden Delphi-Quelltext
1:
2:
if (Button1.Caption = 'X'and (Button2.Caption = 'X'and (Button3.Caption = 'X'then 
// ...

_________________
We are, we were and will not be.
marcon01 Threadstarter
Hält's aus hier
Beiträge: 11



BeitragVerfasst: Do 10.11.11 09:19 
Danke euch ^^