-
Notifications
You must be signed in to change notification settings - Fork 0
/
uDesignation.pas
100 lines (87 loc) · 2.37 KB
/
uDesignation.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
94
95
96
97
98
99
100
unit uDesignation;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uTemplate1, StdCtrls, Buttons, Grids, Wwdbigrd, Wwdbgrid, ExtCtrls,
StrUtils, DB, DBAccess, MyAccess;
type
TfrmDesignation = class(TfrmTemplate1)
procedure btnOKClick(Sender: TObject);
procedure btnCANCELClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure wdbgrdDetailRowChanged(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmDesignation: TfrmDesignation;
implementation
uses modVarType, modFunctions, modPublicVar, dtmData;
{$R *.dfm}
procedure TfrmDesignation.btnCANCELClick(Sender: TObject);
begin
inherited;
DiscardRecord(frmData.tblDesignation);
end;
procedure TfrmDesignation.btnOKClick(Sender: TObject);
begin
inherited;
AcceptRecord(frmData.tblDesignation);
Close;
end;
procedure TfrmDesignation.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
with frmData.tblDesignation do
begin
if State in [dsInsert, dsEdit] then
begin
if (State = dsInsert) and (Modified <> True) then
begin
btnCANCELClick(Sender);
Action := caFree;
end
else
begin
case Application.MessageBox(PChar('Do you want to save changes?'), PChar(Application.Title), mb_YESNOCANCEL + mb_DefButton1 + mb_IconWarning) of
IDYES:
begin
btnOKClick(Sender);
Action := caFree;
end;
IDNO:
begin
btnCANCELClick(Sender);
Action := caFree;
end;
IDCANCEL:
begin
Action := caNone;
end;
end;
end;
end
else
begin
Action := caFree;
end;
end;
end;
procedure TfrmDesignation.FormCreate(Sender: TObject);
begin
inherited;
with frmData.tblDesignation do
begin
if not Active then Active := True;
Refresh;
end;
end;
procedure TfrmDesignation.wdbgrdDetailRowChanged(Sender: TObject);
begin
inherited;
DisplayRecordCount(frmData.tblDesignation,pnlRecordCtr);
end;
end.