unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
canceled:boolean;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
canceled:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
canceled:=false;
for i:=1 to 10000do
begin
application.ProcessMessages;
if canceled=true then
break;
label1.Caption:=inttostr(i);
label1.Refresh;
end;
end;
end.