-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParams.pas
93 lines (77 loc) · 2.2 KB
/
Params.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
92
93
unit Params;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TfrmParams = class(TForm)
lblRefresh: TLabel;
edRefresh: TEdit;
btnOk: TButton;
Button1: TButton;
cbAutorun: TCheckBox;
private
procedure SetAutoRun(const Value: boolean);
procedure SetAutorunLock(const Value: boolean);
procedure SetInterval(const Value: byte);
function GetAutoRun: boolean;
function GetInterval: byte;
function GetAutorunLock: boolean;
public
property Interval:byte read GetInterval write SetInterval;
property AutoRun:boolean read GetAutoRun write SetAutoRun;
property AutorunLock:boolean read GetAutorunLock write SetAutorunLock;
end;
procedure ChangeParams(var Interval:byte;
var AutoRun:boolean; AutorunLock:boolean);
implementation
{$R *.dfm}
procedure ChangeParams(var Interval:byte;
var AutoRun:boolean; AutorunLock:boolean);
var Frm:TfrmParams;
CP:TPoint;
begin
Frm := TfrmParams.Create(nil);
try
GetCursorPos(CP);
if CP.X+Frm.Width>Screen.WorkAreaRect.Right then CP.X:=Screen.WorkAreaRect.Right-Frm.Width;
if CP.Y+Frm.Height>Screen.WorkAreaRect.Bottom then CP.Y:=Screen.WorkAreaRect.Bottom-Frm.Height;
Frm.Left := CP.X;
Frm.Top := CP.Y;
Frm.Interval := Interval;
Frm.AutoRun := AutoRun;
Frm.AutorunLock := AutorunLock;
if Frm.ShowModal=mrOk then begin
Interval := Frm.Interval;
if not AutorunLock then AutoRun := Frm.AutoRun;
end;
finally
Frm.Release;
end;
end;
{ TfrmParams }
function TfrmParams.GetAutoRun: boolean;
begin
Result:=cbAutorun.Checked;
end;
function TfrmParams.GetAutorunLock: boolean;
begin
Result:=not cbAutorun.Enabled;
end;
function TfrmParams.GetInterval: byte;
begin
Result:=StrToInt(edRefresh.Text);
end;
procedure TfrmParams.SetAutoRun(const Value: boolean);
begin
cbAutorun.Checked:=Value;
end;
procedure TfrmParams.SetAutorunLock(const Value: boolean);
begin
cbAutorun.Enabled:=not AutorunLock;
end;
procedure TfrmParams.SetInterval(const Value: byte);
begin
edRefresh.Text:=IntToStr(Interval);
end;
end.