This repository has been archived by the owner on May 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprogressfrm.pas
91 lines (75 loc) · 1.66 KB
/
progressfrm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit progressfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls;
type
TfProgress = class(TForm)
Panel1: TPanel;
lStatus: TLabel;
pProgress: TPanel;
pbProgress: TProgressBar;
Label1: TLabel;
Panel3: TPanel;
pbOverallProgress: TProgressBar;
bCancel: TButton;
procedure bCancelClick(Sender: TObject);
public
Cancelled : boolean;
lastUpdate : integer;
lastOverall : Int64;
procedure setStatus(s:string);
procedure setValue(n:Int64);
procedure setMax(n:Int64);
procedure setOverallMax(n:Int64);
procedure setOverallValue(n:Int64);
procedure UpdateDisplay;
end;
function beginProgress(title:string; multi:boolean):TfProgress;
implementation
{$R *.dfm}
procedure TfProgress.UpdateDisplay;
var
l:integer;
begin
l := GetTickCount;
if l-lastUpdate > 500 then begin
lastUpdate := l;
Application.ProcessMessages;
end;
end;
function beginProgress;
begin
Application.CreateForm(TfProgress,Result);
with Result do begin
pProgress.Visible := multi;
Caption := title;
Show;
UpdateDisplay;
end;
end;
procedure TfProgress.bCancelClick(Sender: TObject);
begin
Cancelled := true;
end;
procedure TfProgress.setMax(n: Int64);
begin
pbProgress.Max := n;
end;
procedure TfProgress.setOverallMax(n: Int64);
begin
pbOverallProgress.Max := n;
end;
procedure TfProgress.setOverallValue(n: Int64);
begin
pbOverallProgress.Position := n;
end;
procedure TfProgress.setStatus(s: string);
begin
lStatus.Caption := s;
end;
procedure TfProgress.setValue(n: Int64);
begin
pbProgress.Position := n;
end;
end.