![]() |
if Klausel: Wort für "aktiv"?
Hallo an alle,
ich hab ein Problem: Wie heißt das Wort für "aktiv" in einer if then Klausel? Also wenn der Radiobutton aktiv ist (angeklickt ist) soll nach einem Klick auf einen Button das un das passieren... Sollte auch per "and" funktionieren, also in ner RadioGroupbox. danke schon ma für eure Bemühungen nixalsverdruss |
Re: if Klausel: Wort für "aktiv"?
RadioButton.checked
Grüße Klaus |
Re: if Klausel: Wort für "aktiv"?
Vielen Dank! süper! :lol:
|
Re: if Klausel: Wort für "aktiv"?
Hi.
Wie Klaus schon schreibt für den einzelnen RadioButton "checked". Willst Du ein RadioGroup abfragen, löst Du das am Besten mit Case, da Du den selektierten Eintrag über "ItemIndex" ermittelst:
Delphi-Quellcode:
Geht natürlich auch mit if, ist aber etwas mehr Schreibarbeit:
case RadioGroup1.ItemIndex of
-1: ShowMessage('Nichts markiert'); 0: Tuwas; 1: Tuwas; end;
Delphi-Quellcode:
Gruß
if RadioGroup1.ItemIndex = -1 then
ShowMessage('Nichts markiert') else if RadioGroup1.ItemIndex = 0 then Tuwas else if RadioGroup1.ItemIndex = 1 then Tuwas else Tuwas; Michael |
Re: if Klausel: Wort für "aktiv"?
Danke an Michael,
so funktionierts besser... |
Re: if Klausel: Wort für "aktiv"?
Hey,
ich hab noch ein Problem zu if-Klauseln: Wie schreibe ich: "wenn das und das nicht im Editfeld eingetragen wurde, dann das und das machen"? Also wenn etwas richtig eingetragen wurde passiert etwas. Das habe ich so gelöst:
Delphi-Quellcode:
Danke schon mal im Voraus
procedure TForm15.Button1Click(Sender: TObject);
begin if (edit1.Text= 'Grotvadder') and (edit2.Text= 'lääwt') then Form16.Show; if (edit1.Text= 'Grotvadder') and (edit2.Text= 'lääwt') then close; nixalsverdruss |
Re: if Klausel: Wort für "aktiv"?
Zitat:
Delphi-Quellcode:
oder
procedure TForm15.Button1Click(Sender: TObject);
begin if (edit1.Text= 'Grotvadder') and not (edit2.Text= 'lääwt') then Form16.Show; if (edit1.Text= 'Grotvadder') and not (edit2.Text= 'lääwt') then close;
Delphi-Quellcode:
Grüße
procedure TForm15.Button1Click(Sender: TObject);
begin if (edit1.Text= 'Grotvadder') and (edit2.Text <> 'lääwt') then Form16.Show; if (edit1.Text= 'Grotvadder') and (edit2.Text <> 'lääwt') then close; Klaus |
Re: if Klausel: Wort für "aktiv"?
Das würde ich mal ändern:
Delphi-Quellcode:
Und das Gegenteil wäre dann:
procedure TForm15.Button1Click(Sender: TObject);
begin if (edit1.Text= 'Grotvadder') and (edit2.Text= 'lääwt') then begin Form16.Show; close; end;
Delphi-Quellcode:
if (edit1.Text <> 'Grotvadder') or (edit2.Text <> 'lääwt') then
|
Re: if Klausel: Wort für "aktiv"?
Dankeschön...das hab ich gesucht! :lol:
|
Re: if Klausel: Wort für "aktiv"?
Ich hab das jetzt so gemacht, aber er zeigt in der "end." Zeile rot an, dass sie falsch wäre. Hier der Delphicode:
Delphi-Quellcode:
Was ist daran falsch?
procedure TForm19.RadioGroup1Click(Sender: TObject);
begin case RadioGroup1.ItemIndex of -1: ShowMessage('Nichts markiert'); 0: Label3.Caption:='Dat is nich richtig! Versöch nochmal!'; 1: Label3.Caption:='Dat is richtig!'; 2: Label3.Caption:='Dat is nich richtig! Versöch nochmal!'; 3: Label3.Caption:='Dat is nich richtig! Versöch nochmal!'; 4: Label3.Caption:='Dat is nich richtig! Versöch nochmal!'; end; end. Danke schon mal im Voraus nixalsverdruss |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:32 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 by Thomas Breitkreuz