Autor Beitrag
gamer94
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 41

Win7 HP, WinXP
Delphi 7 Pers.
BeitragVerfasst: Do 03.01.08 12:50 
Hallo, hier sind keine großen Erklärungen notwendig. Ich versteht einfach nur nicht wieso das Label erst die neue Caption bekommt, wenn die Schleife durchgelaufen ist.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
for i := 0 downto 9 do
  begin
    label1.Caption:= inttostr(i);
    windows.Beep(440,100);
    sleep(900);
  end;
end;
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Do 03.01.08 12:54 
Weil Windows keine Möglichkeit bekommt, den neuen Caption anzuzeigen :)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
for i := 9 downto 0 do
  begin
    label1.Caption:= inttostr(i);
    Application.ProcessMessages;
    windows.Beep(440,100);
    sleep(900);
  end;
end;


Außerdem kann eine Schleife nicht bei 0 anfangen und abwärts bis 9 durchlaufen.


Zuletzt bearbeitet von Yogu am Do 03.01.08 12:56, insgesamt 1-mal bearbeitet
Mitmischer 1703
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 754
Erhaltene Danke: 19

Win 7, Debian
Delphi Prism, Delphi 7, RAD Studio 2009 Academic, C#, C++, Java, HTML, PHP
BeitragVerfasst: Do 03.01.08 12:54 
Setz' da ein Application.Processmessages ein!

_________________
Die Lösung ist nicht siebzehn.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Do 03.01.08 12:58 
Schneller :P
gamer94 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 41

Win7 HP, WinXP
Delphi 7 Pers.
BeitragVerfasst: Do 03.01.08 12:58 
Danke hat geklappt! Innerhalb von 4 Minuten beantwortet. Geial :D