![]() |
and im if verhält sich seltsam
(ich kannte keinen besseren Titel! SRY!)
Ich habe eine Abfrage, die mir den Koffer errechnet. Nun kann es sein, dass gar keiner selektiert ist, deshalb mache ich diese Abfrage:
Delphi-Quellcode:
Wenn diese wahr ist, dann ist ein Koffer selektiert!
if (col >= 0) and ((row = 0) and (col <= 7)) or ((row = 1) and (col <= 6)) or ((row = 2) and (col <= 5)) or ((row = 3) and (col <= 4)) then begin
col ist der Koffer von Links und row ist die Zeile. (Berechnung in Mousemove:
Delphi-Quellcode:
)
row := Floor(Y / 70);
side := Floor(5 + row * 32.5); col := Floor((x - side) / 70); Wenn jetzt col kleiner als null ist (also der erste teil "col >= 0" nicht wahr ist), dann springt er trotzdem rein! Obwohl bei And es eigentlich beides wahr sein muss! (1 and 1 = 1 aber 0 and 1 = 0!) |
Re: and im if verhält sich seltsam
Wenn der erste Term immer wahr sein muß, dann fehlt eine Klammer
Delphi-Quellcode:
if (col >= 0) and (((row = 0) and (col <= 7)) or ((row = 1) and (col <= 6)) or ((row = 2) and (col <= 5)) or ((row = 3) and (col <= 4))) then begin
|
Re: and im if verhält sich seltsam
Dir fehlt eine Klammer um sämtliche ors ;)
Delphi-Quellcode:
...:cat:...
if (col >= 0) and ( ((row = 0) and (col <= 7)) or ((row = 1) and (col <= 6)) or ((row = 2) and (col <= 5)) or ((row = 3) and (col <= 4)) ) then begin
|
Re: and im if verhält sich seltsam
Ah ^^ Danke ;)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:06 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz