{*******************************************************} { } { Responsive Software http://www.responsive.co.nz } { } { Copyright (c) 2003-2006 Responsive Software Limited } { } {*******************************************************} unit Progress; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Base, StdCtrls, ComCtrls; type TProgressForm = class(TBaseForm) ProgressBar: TProgressBar; ProgressLabel: TLabel; procedure FormShow(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } EscapePressed : boolean; procedure SetCaption (Caption : string); procedure SetStep (Step : integer); procedure StepIt; procedure SetPosition (Position : integer); end; var ProgressForm: TProgressForm; implementation {$R *.dfm} procedure TProgressForm.SetCaption (Caption : string); begin ProgressLabel.Caption := Caption; ProgressBar.Position := 0; Repaint; end; procedure TProgressForm.SetStep (Step : integer); begin ProgressBar.Step := Step; end; procedure TProgressForm.StepIt; begin ProgressBar.StepIt; Repaint; end; procedure TProgressForm.SetPosition (Position : integer); begin if Position <> ProgressBar.Position then begin ProgressBar.Position := Position; Repaint; end; end; procedure TProgressForm.FormShow(Sender: TObject); begin EscapePressed := false; end; procedure TProgressForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_ESCAPE then begin EscapePressed := true; Key := 0; end; end; end.