Autor Beitrag
Default112
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Fr 19.03.04 14:05 
So, ich habe mal mein Problem vereinfacht dargestellt:

Ich habe einen Button, da drück ich drauf und er rechnet was, das dauert ziemlich lange.
Während gerechnet wird, kann ich aber keine anderen Buttons drücken.

Um das zu vereinfachen, habe ich mal nen kleines Programm geschreiben, was mein Problem veranschaulicht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.FormCreate(Sender: TObject);
begin
  gedrueckt := false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  repeat until gedrueckt;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
  gedrueckt := true;
end;


Ungefähr so stellt soch mein Problem dar. Ich muss also die Schleife durch einen Knopfdruck abbrechen können.

MFG
Def
Adrian
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 314



BeitragVerfasst: Fr 19.03.04 14:21 
Servus!

Mach mal das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject); 
begin 
  repeat
    Application.ProcessMessages;
  until gedrueckt; 
end;


Dann müßte es klappen.

Gruß,

Adrian
Default112 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Fr 19.03.04 21:45 
Also soll das "Application.ProcessMessages;" dahin, wo er den Button abragen soll, richtig?