Autor Beitrag
Gottdrak99
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


D7 & D6 Ent
BeitragVerfasst: Sa 03.04.04 19:58 
Ja, hallo
man macht z.B. eine Variable und Timer Komponent, und man will das der Timer nach 1Sek 1 von Variable abzieht

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Timer1Timer(Sender: TObject);
var
b1:byte;
begin
b1:=20;
b1:=b1-1;
end;


tja wird immer auf 20 gesetzt, wenn man konstante benutzt wird ein fehler rauskommen

ausblenden Delphi-Quelltext
1:
2:
var
b1:byte=20;


kommt auch ein fehler


meine frage kann man das irgedwie in timer noch erwähnen, dass b1 20 ist weil ich habe das immer so gemacht und das ist mir zu lang

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  b1:byte=20;
implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
b1:=b1-1;
end;


Moderiert von user profile icontommie-lie: Code- durch Delphi-Tags ersetzt
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 03.04.04 20:06 
Da Herr Wirth static-Variablen leider vergessen hat, wird es sauber nicht anders gehen als deine "lange" Lösung.
Aber alternativ kannst du Timer1.Tag benutzen, ist ein Integer und zur freien Verwendung resserviert.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert