Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Konstantenausdruck erwartet (https://www.delphipraxis.net/24849-konstantenausdruck-erwartet.html)

aerotech 27. Jun 2004 14:44


Konstantenausdruck erwartet
 
Delphi-Quellcode:
procedure Stufen;
begin

  count:= count +1;

  with Form1 do begin
    case count of

     1: begin
     Lb_Stufe1.Font.color := clred;
     Lb_Stufe15.Font.color := clWhite;
     end;

     2: begin
     Lb_Stufe2.Font.color := clred;
     Lb_Stufe1.Font.color := clWhite;
     end;

     3: begin
     Lb_Stufe3.Font.color := clred;
     Lb_Stufe2.Font.color := clWhite;
     end;

     4: begin
     Lb_Stufe4.Font.color := clred;
     Lb_Stufe3.Font.color := clWhite;
     end;

     5: begin
     Lb_Stufe5.Font.color := clred;
     Lb_Stufe4.Font.color := clWhite;
     end;

     6: begin
     Lb_Stufe6.Font.color := clred;
     Lb_Stufe5.Font.color := clWhite;
     end;

     7: begin
     Lb_Stufe7.Font.color := clred;
     Lb_Stufe6.Font.color := clWhite;
     end;

     8: begin
     Lb_Stufe8.Font.color := clred;
     Lb_Stufe7.Font.color := clWhite;
     end;

     9: begin
     Lb_Stufe9.Font.color := clred;
     Lb_Stufe8.Font.color := clWhite;
     end;

     10: begin
     Lb_Stufe10.Font.color := clred;
     Lb_Stufe9.Font.color := clWhite;
     end;

     11: begin
     Lb_Stufe11.Font.color := clred;
     Lb_Stufe10.Font.color := clWhite;
     end;

     12: begin
     Lb_Stufe12.Font.color := clred;
     Lb_Stufe11.Font.color := clWhite;
     end;

     13: begin
     Lb_Stufe13.Font.color := clred;
     Lb_Stufe12.Font.color := clWhite;
     end;

     14: begin
     Lb_Stufe14.Font.color := clred;
     Lb_Stufe13.Font.color := clWhite;
     end;

     15: begin
     Lb_Stufe15.Font.color := clred;
     Lb_Stufe14.Font.color := clWhite;
     end;

       if count = 15 then begin

       Frage1.Visible := false;
       Frage2.Visible := false;
       Frage3.Visible := false;
       Frage4.Visible := false;
       end;

    end;
  end;
end;
beim end unter der if anweisung kommt -> [Fehler] Unit1.pas(184): Konstantenausdruck erwartet

ich hab mal end; weggenommen, welche hinzugefügt, aber nix passiert...immer die meldung (s.o) :wall:

Matze 27. Jun 2004 14:47

Re: Konstantenausdruck erwartet
 
Schreib mal anstatt:
Delphi-Quellcode:
15: begin
     Lb_Stufe15.Font.color := clred;
     Lb_Stufe14.Font.color := clWhite;
     end;

       if count = 15 then begin

       Frage1.Visible := false;
       Frage2.Visible := false;
       Frage3.Visible := false;
       Frage4.Visible := false;
       end;

    end;
  end;
end;
folgendes:

Delphi-Quellcode:
15: begin
     Lb_Stufe15.Font.color := clred;
     Lb_Stufe14.Font.color := clWhite;
     end;
   end;

       if count = 15 then begin

       Frage1.Visible := false;
       Frage2.Visible := false;
       Frage3.Visible := false;
       Frage4.Visible := false;
       end;
  end;
end;
Ungetestet.

Nikolas 27. Jun 2004 14:57

Re: Konstantenausdruck erwartet
 
Was hast du denn gegen die Findcomponent-Lösung :gruebel:

glkgereon 27. Jun 2004 21:06

Re: Konstantenausdruck erwartet
 
ausser dem hast du da irgendwie:

Delphi-Quellcode:
case count of
...usw...
     15: begin
     Lb_Stufe15.Font.color := clred;
     Lb_Stufe14.Font.color := clWhite;
     end;

       if count = 15 then begin

       Frage1.Visible := false;
       Frage2.Visible := false;
       Frage3.Visible := false;
       Frage4.Visible := false;
       end;
mach doch so:

Delphi-Quellcode:
case count of
...usw...
     15: begin
     Lb_Stufe15.Font.color := clred;
     Lb_Stufe14.Font.color := clWhite;
     Frage1.Visible := false;
     Frage2.Visible := false;
     Frage3.Visible := false;
     Frage4.Visible := false;
     end;
oder wo ist der unterschied?


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz