-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUHelpForm.pas
More file actions
89 lines (78 loc) · 1.9 KB
/
UHelpForm.pas
File metadata and controls
89 lines (78 loc) · 1.9 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
unit UHelpForm;
interface
uses
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, UInfo;
type
TfrmHelp = class(TForm)
lbl1: TLabel;
lbl2: TLabel;
lbl3: TLabel;
btnOK: TButton;
btnCancel: TButton;
edtNumber: TEdit;
edtPersonName: TEdit;
edtAdress: TEdit;
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
info: TInfo;
IsView: boolean;
procedure SetParams(AInfo: TInfo; AIsView: Boolean);
end;
implementation
{$R *.dfm}
{ TfrmHelp }
procedure TfrmHelp.btnOKClick(Sender: TObject);
begin
if IsView then
ModalResult := mrOk
else
begin
if trim(edtNumber.Text) = '' then
begin
MessageDlg('Íîìåð òåëåôîíà íå ìîæåò áûòü ïóñòûì ', mtError, [mbOk], 0);
edtNumber.SetFocus;
exit
end;
/////
if trim(edtPersonName.Text) = '' then
begin
MessageDlg('Ó íîìåðà òåëåôîíà äîëæåí áûòü õîçÿèí ', mtError, [mbOk],
0);
edtPersonName.SetFocus;
exit
end;
if trim(edtAdress.Text) = '' then
begin
MessageDlg('Ó ÷åëîâåêà íå ìîæåò îòñóòñòâîâàòü àäðåñ', mtError, [mbOk], 0);
edtAdress.SetFocus;
exit
end;
info.Number := trim(edtNumber.Text);
info.PersonName := trim(edtPersonName.Text);
info.Adress := trim(edtAdress.Text);
ModalResult := mrOk
end;
end;
procedure TfrmHelp.SetParams(AInfo: TInfo; AIsView: Boolean);
begin
IsView := AIsView;
if IsView then
begin
info := AInfo;
edtNumber.Text := info.Number;
edtPersonName.Text := info.PersonName;
edtAdress.Text := info.Adress;
end;
edtNumber.ReadOnly := IsView;
edtPersonName.ReadOnly := IsView;
edtAdress.ReadOnly := IsView;
btnCancel.Visible := not IsView;
if IsView then
btnOK.Left := 160
else
btnOK.Left := 96;
end;
end.