Autor Beitrag
bonanza
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mo 14.11.05 19:31 
hi,

mein problem:

Ich habe eine eindeutige zuordnung aber es kommen die falschen werte heraus z.B.:

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:
40:
41:
42:
43:
44:
begin
 {1}
  if CheckBox1.checked = true
  and CheckBox3.checked = true
  then Edit1.Text := ('Asis');
 {2}
  if CheckBox1.Checked = false
  and CheckBox4.Checked = true
  then Edit1.Text := ('Belas');
 {3}
  if CheckBox1.Checked = true
  and CheckBox3.Checked = false
  and CheckBox4.Checked = true
  then Edit1.Text := ('Cedis');
 {4}
  if CheckBox1.Checked = false
  and CheckBox2.Checked = true
  and CheckBox3.Checked = true
  and CheckBox4.Checked = false
  then Edit1.Text := ('Cedis');
 {5}
  if CheckBox1.Checked = false
  and CheckBox2.Checked = true
  and CheckBox3.Checked = false
  and CheckBox4.Checked = false
  then Edit1.Text := 'Drudis';
 {6}
  if CheckBox1.Checked = true
  and CheckBox3.Checked = False
  and CheckBox4.Checked = False
  then Edit1.Text := 'Drudis';
 {7}
  if CheckBox1.Checked =false
  and CheckBox2.Checked = false
  and CheckBox3.Checked = true
  and CheckBox4.Checked = false
  then Edit1.Text := 'Drudis';
 {8}
  if Checkbox1.Checked = false
  and checkbox2.checked = false
  and checkbox3.checked = false
  and Checkbox4.Checked = false
  then Edit1.Text := 'Cedis';
  end;



Wenn ich das 1. angekreuzt habe und das 3., dann Spuckt er nicht ASIS sondern CEDIS aus...woran kann das liegen ?

danke schonmal im voraus
bonanza
Einloggen, um Attachments anzusehen!


Zuletzt bearbeitet von bonanza am Mo 14.11.05 19:56, insgesamt 2-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 14.11.05 19:42 
Hallo!

Die Qualität und Häufigkeit von Antworten in diesem Forum hängt direkt mit der Qualität der Frage zusammen. Wenn Du also möchtest, dass jemand Mühe in eine Antwort investiert, solltest Du auch Mühe in Deine Frage investieren. Das heisst in diesem Fall:

(1) Beschreibe Dein Problem! Was funktioniert nicht? Was sollte passieren, was passiert nicht, was passiert stattdessen?
(2) Poste die relevanten Codeteile. Es ist einem Antwortenden nicht zuzumuten, sich erst einmal das Programm runterladen zu müssen.

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Green
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: Mo 14.11.05 22:04 
Du könntest versuchen die
ausblenden Delphi-Quelltext
1:
  if CheckBox1.Checked = false and CheckBox2.Checked = true and CheckBox3.Checked = true					


mit klammern zu schreiben also:

ausblenden Delphi-Quelltext
1:
2:
  if (CheckBox1.Checked = false) and (CheckBox2.Checked = true) and (CheckBox3.Checked = true) then
//blubber... druddel
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: Mo 14.11.05 22:42 
Das könnte er nicht nur, das muss er sogar.
Sonst interpretiert der Compiler das anders.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Green
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: Mo 14.11.05 22:51 
war mir nit so sicher, und wenn ich jetzt komm mit 'mach ma' oder 'musste so machen...' und stimmt nit, dann steh ich dumm da... so nit... *g*

ach ja @ Gta-Place:

wie interpretiert er des dann denn? bei mir kommt da dann immer fehlermeldung, warum nicht bei ihm?...

//EDIT: Frage geadded... (ich weiss extra thread...) aber dann ises zusammenhangslos... (Bitte nicht Löschen...)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 14.11.05 22:57 
user profile iconGreen hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
  if (CheckBox1.Checked = false) and (CheckBox2.Checked = true) and (CheckBox3.Checked = true) then
//blubber... druddel


geht kürzer als:

ausblenden Delphi-Quelltext
1:
2:
  if (not CheckBox1.Checked) and CheckBox2.Checked and CheckBox3.Checked then
//blubber... druddel

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 14.11.05 23:03 
user profile iconGreen hat folgendes geschrieben:
war mir nit so sicher, und wenn ich jetzt komm mit 'mach ma' oder 'musste so machen...' und stimmt nit, dann steh ich dumm da... so nit... *g*

ach ja @ Gta-Place:

wie interpretiert er des dann denn? bei mir kommt da dann immer fehlermeldung, warum nicht bei ihm?...

//EDIT: Frage geadded... (ich weiss extra thread...) aber dann ises zusammenhangslos... (Bitte nicht Löschen...)


Da kommt bei jedem ne Fehlermeldung und da wird nichts anders interpretiert sondern dann wird da überhaupt nichts mehr interprediert :P

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
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: Mo 14.11.05 23:07 
Nope. Bei D7 PE kommt keine Fehlermeldung.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 14.11.05 23:10 
Glei mal ausprobieren jetzt! :P

EDIT: Also bei mit interpretiert er   if CheckBox1.Checked = false and CheckBox2.Checked = true and CheckBox3.Checked = true genau richtig! Da hab ich mich wohl zuviel auf die kommentare anderer verlassen :P
EDIT2: Doch nicht ganz richtig ^^ So gut wie alle möglichkeiten können Checked sein bei der variante ;)

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.


Zuletzt bearbeitet von Born-to-Frag am Mo 14.11.05 23:20, insgesamt 1-mal bearbeitet
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 14.11.05 23:16 
Der Source verursacht keinen semantischen Fehler, da alles Booleans sind und Boolean = Boolean und Boolean AND Boolean beides immer Booleans liefern.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 15.11.05 00:07 
Syntaktisch ist es korrekt (es compiliert), semantisch jedoch nicht (Bedeutung falsch).

Denn dein Ausdruck:

 if CheckBox1.Checked = false and CheckBox2.Checked = true and CheckBox3.Checked = true then

bedeutet soviel wie:

 if CheckBox1.Checked = (false and CheckBox2.Checked) = (true and CheckBox3.Checked) = true then

und das wiederum soviel wie:

 if CheckBox1.Checked <> CheckBox3.Checked then

Und, dass das nicht das ist, was du wolltest, sollte dann offensichtlich sein.

And bindet stärker als = und das macht auch in den meisten Fällen Sinn. In deinem Fall musst du also unbedingt Klammern setzen -- oder besser die Vergleiche mit true und false ganz weglassen. Statt einen Ausdruck mit false zu vergleichen, solltest du den not nutzen; mit true vergleichen musst du generell nie, weil ein solcher Vergleich den Wahrheitswert nicht ändert.
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 15.11.05 03:17 
Die AND dürften klar sein, aber da ist doch ein grundlegender Fehler gleich mit eingebaut : es gibt ein IF und dann wieder eines usw. Also gilt : wer zuletzt kommt malt zuerst. :mrgreen: Den Rest guck ich mir erst gar nicht an. Das Wort ELSE gibt es auch noch. 8)

_________________
Gruß
Hansa
bonanza Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 15.11.05 07:07 
super daran lags !!!

DANKE !
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 15.11.05 13:07 
Und die Krönung in dem Thread ist das :

user profile iconGTA-Place hat folgendes geschrieben:
Nope. Bei D7 PE kommt keine Fehlermeldung.


:lol:

_________________
Gruß
Hansa
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 15.11.05 17:10 
Was soll die Krönung daran sein?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 15.11.05 17:18 
Einen Fehler in Delphi zu vermuten und sich dann wundern, daß keine Fehlermeldung kommt, weil es eben ein eigener Fehler war. Echt köstlich. :lol:

_________________
Gruß
Hansa
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 15.11.05 17:59 
user profile iconBorn-to-Frag hat folgendes geschrieben:
Da kommt bei jedem ne Fehlermeldung und da wird nichts anders interpretiert sondern dann wird da überhaupt nichts mehr interprediert :P

Wurde aber behauptet und ich hab mich nie irgendwie darüber gewundert.

Ich weiß nicht was dein Problem ist. Wenn einer behauptet, dass da ne Fehlermeldung kommt
und es kommt keine, dann darf ich das wohl widerlegen oder stört dich das?
Ich kanns auch nächstesmal lassen und alle bleiben im Glaube, dass wirklich eine Fehlermeldung kommt.

Falls du noch etwas zu sagen hat, dann schick mir ne PN.
Hier im Topic wird nicht mehr darüber diskutiert.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 15.11.05 18:10 
user profile iconGTA-Place hat folgendes geschrieben:
user profile iconBorn-to-Frag hat folgendes geschrieben:
Da kommt bei jedem ne Fehlermeldung und da wird nichts anders interpretiert sondern dann wird da überhaupt nichts mehr interprediert :P

Wurde aber behauptet und ich hab mich nie irgendwie darüber gewundert.

Ich weiß nicht was dein Problem ist. Wenn einer behauptet, dass da ne Fehlermeldung kommt
und es kommt keine, dann darf ich das wohl widerlegen oder stört dich das?
Ich kanns auch nächstesmal lassen und alle bleiben im Glaube, dass wirklich eine Fehlermeldung kommt.

Falls du noch etwas zu sagen hat, dann schick mir ne PN.
Hier im Topic wird nicht mehr darüber diskutiert.


Habe ich nicht gesagt das ich mich geirrt habe? :gruebel:
Also was ist DEIN Problem?

greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
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 15.11.05 18:12 
Ja hast du gesagt. Ich hab das Zitat nur für hansa gebracht,
weil er scheinbar dachte, dass ich das gesagt hätte...

--> Hätte hansa nix gesagt, wäre alles wunderbar gewesen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 15.11.05 18:15 
Ich denke, Ihr solltet das Thema per PN klären. :-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".