-
Notifications
You must be signed in to change notification settings - Fork 0
/
BS_Dialogs.pas
64 lines (50 loc) · 1.28 KB
/
BS_Dialogs.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
// BS_Dialogs.PAS
// By Banshee & Stucuk
unit BS_Dialogs;
interface
uses
SysUtils, ExtCtrls, Forms, ComCtrls, StdCtrls, Dialogs;
var
AProgressDialog: TForm;
procedure OpenProgressDialog(PDCaption: string; PDMax: integer);
procedure UpdateProgressDialog(Position: integer);
procedure CloseProgressDialog;
implementation
procedure OpenProgressDialog(PDCaption: string; PDMax: integer);
var
AProgressBar: TProgressBar;
begin
AProgressDialog := CreateMessageDialog('Progress', mtWarning, []);
AProgressBar := TProgressBar.Create(AProgressDialog);
with AProgressDialog do
begin
Caption := PDCaption;
Height := 150;
with AProgressBar do
begin
Name := 'Progress';
Parent := AProgressDialog;
Max := PDMax; //seconds
Step := 1;
Top := 100;
Left := 8;
Width := AProgressDialog.ClientWidth - 16;
end;
Show;
end;
end;
procedure UpdateProgressDialog(Position: integer);
var
aPB: TProgressBar;
begin
with AProgressDialog do
aPB := TProgressBar(FindComponent('Progress'));
aPB.Position := Position;
AProgressDialog.Caption := IntToStr(aPB.Max);
end;
procedure CloseProgressDialog;
begin
AProgressDialog.Close;
AProgressDialog.Free;
end;
end.