-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFrames.Progress.pas
More file actions
101 lines (81 loc) · 2.07 KB
/
Frames.Progress.pas
File metadata and controls
101 lines (81 loc) · 2.07 KB
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
92
93
94
95
96
97
98
99
100
101
unit Frames.Progress;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
System.Math,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Frames.Persistent, Vcl.ComCtrls,
Vcl.StdCtrls;
type
TfrProgress = class(TfrmPersistent)
lblComment: TLabel;
pbProgress: TProgressBar;
private
FTitle: string;
FProgress: Integer;
FIsDetermined: Boolean;
function GetTitle: string; inline;
procedure SetTitle(const Value: string); inline;
function GetIsDetermined: Boolean; inline;
function GetProgress: Integer; inline;
procedure SetIsDetermined(const Value: Boolean); inline;
procedure SetProgress(const Value: Integer); inline;
public
property Title: string read GetTitle write SetTitle;
property Progress: Integer read GetProgress write SetProgress;
property IsDetermined: Boolean read GetIsDetermined write SetIsDetermined;
procedure Reset; inline;
constructor Create(AOwner: TWinControl); override;
end;
var
frProgress: TfrProgress;
implementation
{$R *.dfm}
{ TfrProgress }
constructor TfrProgress.Create(AOwner: TWinControl);
begin
inherited Create(AOwner);
Parent := AOwner;
FTitle := string.Empty;
FProgress := 0;
FIsDetermined := False;
end;
function TfrProgress.GetIsDetermined: Boolean;
begin
Result := FIsDetermined;
end;
function TfrProgress.GetProgress: Integer;
begin
Result := FProgress;
end;
function TfrProgress.GetTitle: string;
begin
Result := FTitle;
end;
procedure TfrProgress.Reset;
begin
FProgress := 0;
end;
procedure TfrProgress.SetIsDetermined(const Value: Boolean);
begin
FIsDetermined := Value;
end;
procedure TfrProgress.SetProgress(const Value: Integer);
begin
if FProgress <> Value then
begin
FProgress := Value;
if FIsDetermined then
pbProgress.Position := FProgress
else
pbProgress.Position := Trunc(Log10(FProgress) * 10);
end;
end;
procedure TfrProgress.SetTitle(const Value: string);
begin
if FTitle <> Value then
begin
FTitle := Value;
lblComment.Caption := FTitle;
end;
end;
end.