Entwickler-Ecke

Delphi Language (Object-Pascal) / CLX - Problem mit if Abfrage


breakdancer1111 - Sa 15.11.03 17:18
Titel: Problem mit if Abfrage
Hallo,
ich hät da mal ne'n Problem mit ner if Abfrage.
Ich habe 3 TCheckBoxes's, 1 TButton und eine TMemo auf meiner Form.
Wenn man auf den Button klickt erscheint in der Memo nen Text.

Hier mal der Code.

Delphi-Quelltext
1:
2:
3:
4:
5:
  if Icon.Checked = true then
  begin
    Editor.Text.Lines.Add('    window.open("popup.php","FensterName","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,fullscreen=0,width=' + Breite.Text + ',height=' + Hoehe.Text + '")');
  if Adress.Checked = true then
        Editor.Text.Lines.Add('    window.open("popup.php","FensterName","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,fullscreen=0,width=' + Breite.Text + ',height=' + Hoehe.Text + '")');


Nun passier folgendes. In der Memo steht:
Zitat:

window.open("popup.php","FensterName","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,fullscreen=0,width=400,height=300")
window.open("popup.php","FensterName","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,fullscreen=0,width=400,height=300")


Alerdings sollte da stehen:
Zitat:

window.open("popup.php","FensterName","toolbar=1,location=1,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,fullscreen=0,width=400,height=300")


Wie kann ich das nun anstellen das das da nur einmal steht?


Keldorn - Sa 15.11.03 17:36

ich versteh jetz dein problem nicht. wenn icon und adress deine checkboxen sind und beide ein häkchen haben, stehen 2 zeilen drin. :?!?:

Mfg Frank


breakdancer1111 - Sa 15.11.03 17:53

Öhm, ja!
Es soll aber nur eine da stehen.
Ich mach mal nen leichteres beispiel mit drei Checkboxen. ^-^
Wenn eine Checkbox aktiv ist soll da stehten.

1, 0, 0

Bei zweien

1, 1, 0

Bei dreihen

1, 1, 1



Mit meinen if abfragen wie im oberen problem würde da stehen:

1
1
1


matze - Sa 15.11.03 17:56

spiel dich mal mitexit;
das ist zwar keine so saubere programmierung, aber es geht.


breakdancer1111 - Sa 15.11.03 18:13

:roll: Haste nen beispiel? Hab noch nie was mit exit gemacht.


Keldorn - Sa 15.11.03 19:19

ähhm, du kannst mich jetzt für blöd erklären, aber ich raff immer noch nicht, was du willst. :autsch: und ich seh in deinem ersten post nicht, wo/warum loaction 1 sein soll

ich nehm auch 3 checkboxen und ein memo, ist hier was passendes für dich dabei?

Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if CheckBox1.Checked then memo1.Lines.add('1 ist aktiv')
   else if CheckBox2.Checked then memo1.Lines.add('2 ist aktiv')
    else if CheckBox3.Checked then memo1.Lines.add('3 ist aktiv')
end;

procedure TForm1.Button2Click(Sender: TObject);
Var s:string;
begin
  if CheckBox1.Checked then s:='1 ist aktiv, '
                       else s:='1 ist inaktiv, ';
  if CheckBox2.Checked then s:=s+'2 ist aktiv, '
                       else s:=s+'2 ist inaktiv, ';
  if CheckBox3.Checked then s:=s+'3 ist aktiv'
                       else s:=s+'3 ist inaktiv';
  memo1.Lines.add(s);
end;


breakdancer1111 - Sa 15.11.03 20:02

Ist net weiterschlimm, wenn du das net rafst. :)
Aber mit der Source die du gepostet hast, sollte das gehen.

Danke! :D