Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi if Klausel: Wort für "aktiv"? (https://www.delphipraxis.net/125129-if-klausel-wort-fuer-aktiv.html)

jakobwenzel 3. Dez 2008 16:05

Re: if Klausel: Wort für "aktiv"?
 
Da fehlt einfach einmal ein
Delphi-Quellcode:
end;

Zwoetzen 3. Dez 2008 16:06

Re: if Klausel: Wort für "aktiv"?
 
Delphi-Quellcode:
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; // case
end; // procedure

end.
Das Case benötigt ein eigenes "end;" ;)

Fussball-Robby 3. Dez 2008 16:08

Re: if Klausel: Wort für "aktiv"?
 
Zitat:

Zitat von jakobwenzel
Da fehlt einfach einmal ein
Delphi-Quellcode:
end;

Was man auch schnell sehen würde, wenn der Code richtig eingerückt wäre. Nach jedem begin, case, try [..] 2 Zeilen nach rechts, mit jedem end; 2 nach links:
Delphi-Quellcode:
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;

end.

nixalsverdruss 3. Dez 2008 16:12

Re: if Klausel: Wort für "aktiv"?
 
Stimmt danke!

mkinzler 3. Dez 2008 16:25

Re: if Klausel: Wort für "aktiv"?
 
Man könnte beim Case auch mehrere werte mit der selben Ausgabe zusammenfassen:
Delphi-Quellcode:
0,2,3,4: Label3.Caption:='Dat is nich richtig! Versöch nochmal!';


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:43 Uhr.
Seite 2 von 2     12   

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