Autor Beitrag
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Sa 08.11.03 15:16 
Wie kann ich eine Procedure Vorzeitig z.B. mit einem button.cklick beenden...

Irgendwie so....
bIce
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 55



BeitragVerfasst: Sa 08.11.03 15:26 
So vielleicht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var
   abbrechen: boolean;

procedure TForm1.Button1Click(Object:TSender);
begin
   abbrechen := true;
end;

procedure doit;
begin
   while true do
   begin
      Application.ProcessMessages;
      if abbrechen then Exit;
   end;
end;

_________________
Gott mag anscheinend einfache Leute, denn er hat viele von ihnen erschaffen.
Alexander F
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 149

Win XP, Win 2000
D6 PE, D7 Prof, D8 Prof
BeitragVerfasst: Sa 08.11.03 15:35 
vielleicht hilft es ja:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.Button1Click(Sender: TObject); 
var 
  LoopAborted: Boolean; 
  i: Integer; 
begin 
  LoopAborted := False; 
  i := 0; 
  repeat 
    // Your Code... 
    Caption := IntToStr(i); 
    Application.ProcessMessages; 

    if GetKeyState(VK_Escape) and 128 = 128 then 
    begin 
      LoopAborted := True; 
      Break; 
    end; 

    Inc(i); 
  until i = 100000; 
  if LoopAborted then 
    ShowMessage('User has aborted the loop!'); 
end;


Quelle: Swissdelphicenter
Ist die Frage beantwortet? Das Problem gelöst?

Dann klicke hier, um das Thema entsprechend zu markieren!