1 | unit fOptionsNotes;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
7 | StdCtrls, ExtCtrls, ORCtrls, ORFn, ComCtrls, fBase508Form,
|
---|
8 | VA508AccessibilityManager;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmOptionsNotes = class(TfrmBase508Form)
|
---|
12 | lblAutoSave1: TLabel;
|
---|
13 | lblCosigner: TLabel;
|
---|
14 | txtAutoSave: TCaptionEdit;
|
---|
15 | spnAutoSave: TUpDown;
|
---|
16 | chkVerifyNote: TCheckBox;
|
---|
17 | chkAskSubject: TCheckBox;
|
---|
18 | cboCosigner: TORComboBox;
|
---|
19 | pnlBottom: TPanel;
|
---|
20 | bvlBottom: TBevel;
|
---|
21 | btnOK: TButton;
|
---|
22 | btnCancel: TButton;
|
---|
23 | lblAutoSave2: TLabel;
|
---|
24 | procedure FormShow(Sender: TObject);
|
---|
25 | procedure btnOKClick(Sender: TObject);
|
---|
26 | procedure txtAutoSaveChange(Sender: TObject);
|
---|
27 | procedure txtAutoSaveKeyPress(Sender: TObject; var Key: Char);
|
---|
28 | procedure txtAutoSaveExit(Sender: TObject);
|
---|
29 | procedure spnAutoSaveClick(Sender: TObject; Button: TUDBtnType);
|
---|
30 | procedure cboCosignerNeedData(Sender: TObject; const StartFrom: String;
|
---|
31 | Direction, InsertAt: Integer);
|
---|
32 | procedure cboCosignerExit(Sender: TObject);
|
---|
33 | private
|
---|
34 | { Private declarations }
|
---|
35 | public
|
---|
36 | { Public declarations }
|
---|
37 | end;
|
---|
38 |
|
---|
39 | var
|
---|
40 | frmOptionsNotes: TfrmOptionsNotes;
|
---|
41 |
|
---|
42 | procedure DialogOptionsNotes(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
43 |
|
---|
44 | implementation
|
---|
45 |
|
---|
46 | {$R *.DFM}
|
---|
47 |
|
---|
48 | uses
|
---|
49 | rOptions, uOptions, rCore, rTIU, rDCSumm;
|
---|
50 |
|
---|
51 | procedure DialogOptionsNotes(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
52 | // create the form and make it modal, return an action
|
---|
53 | var
|
---|
54 | frmOptionsNotes: TfrmOptionsNotes;
|
---|
55 | begin
|
---|
56 | frmOptionsNotes := TfrmOptionsNotes.Create(Application);
|
---|
57 | actiontype := 0;
|
---|
58 | try
|
---|
59 | with frmOptionsNotes do
|
---|
60 | begin
|
---|
61 | if (topvalue < 0) or (leftvalue < 0) then
|
---|
62 | Position := poScreenCenter
|
---|
63 | else
|
---|
64 | begin
|
---|
65 | Position := poDesigned;
|
---|
66 | Top := topvalue;
|
---|
67 | Left := leftvalue;
|
---|
68 | end;
|
---|
69 | ResizeAnchoredFormToFont(frmOptionsNotes);
|
---|
70 | ShowModal;
|
---|
71 | actiontype := btnOK.Tag;
|
---|
72 | end;
|
---|
73 | finally
|
---|
74 | frmOptionsNotes.Release;
|
---|
75 | end;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TfrmOptionsNotes.FormShow(Sender: TObject);
|
---|
79 | // displays defaults
|
---|
80 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
81 | var
|
---|
82 | autosave, verify: integer;
|
---|
83 | cosigner: Int64;
|
---|
84 | values, cosignername: string;
|
---|
85 | begin
|
---|
86 | values := rpcGetOther;
|
---|
87 | autosave := strtointdef(Piece(values, '^', 3), -1);
|
---|
88 | verify := strtointdef(Piece(values, '^', 4), 0);
|
---|
89 | chkVerifyNote.Checked := verify = 1;
|
---|
90 | chkVerifyNote.Tag := verify;
|
---|
91 | spnAutoSave.Position := autosave;
|
---|
92 | spnAutoSave.Tag := autosave;
|
---|
93 |
|
---|
94 | values := rpcGetDefaultCosigner;
|
---|
95 | cosigner := strtoint64def(Piece(values, '^', 1), 0);
|
---|
96 | cosignername := Piece(values, '^', 2);
|
---|
97 | cboCosigner.Items.Add('0^<none>');
|
---|
98 | cboCosigner.InitLongList(cosignername);
|
---|
99 | cboCosigner.SelectByIEN(cosigner);
|
---|
100 | cboCosigner.Tag := cosigner;
|
---|
101 | chkAskSubject.Checked := rpcGetSubject;
|
---|
102 | if chkAskSubject.Checked then chkAskSubject.Tag := 1;
|
---|
103 | end;
|
---|
104 |
|
---|
105 | procedure TfrmOptionsNotes.btnOKClick(Sender: TObject);
|
---|
106 | // only saves values if they have been changed
|
---|
107 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
108 | var
|
---|
109 | values: string;
|
---|
110 | begin
|
---|
111 | values := '';
|
---|
112 | values := values + '^';
|
---|
113 | values := values + '^';
|
---|
114 | if spnAutoSave.Position <> spnAutoSave.Tag then
|
---|
115 | values := values + inttostr(spnAutoSave.Position);
|
---|
116 | values := values + '^';
|
---|
117 | if chkVerifyNote.Checked then
|
---|
118 | if chkVerifyNote.Tag <> 1 then
|
---|
119 | values := values + '1';
|
---|
120 | if not chkVerifyNote.Checked then
|
---|
121 | if chkVerifyNote.Tag <> 0 then
|
---|
122 | values := values + '0';
|
---|
123 | rpcSetOther(values);
|
---|
124 | with chkAskSubject do
|
---|
125 | if (Checked and (Tag = 0)) or (not Checked and (Tag = 1)) then
|
---|
126 | rpcSetSubject(Checked);
|
---|
127 | with cboCosigner do
|
---|
128 | if Tag <> ItemIEN then
|
---|
129 | rpcSetDefaultCosigner(ItemIEN);
|
---|
130 | ResetTIUPreferences;
|
---|
131 | ResetDCSummPreferences;
|
---|
132 | end;
|
---|
133 |
|
---|
134 | procedure TfrmOptionsNotes.txtAutoSaveChange(Sender: TObject);
|
---|
135 | var
|
---|
136 | maxvalue: integer;
|
---|
137 | begin
|
---|
138 | maxvalue := spnAutoSave.Max;
|
---|
139 | with txtAutoSave do
|
---|
140 | begin
|
---|
141 | if strtointdef(Text, maxvalue) > maxvalue then
|
---|
142 | begin
|
---|
143 | beep;
|
---|
144 | InfoBox('Number must be < ' + inttostr(maxvalue), 'Warning', MB_OK or MB_ICONWARNING);
|
---|
145 | if strtointdef(Text, 0) > maxvalue then
|
---|
146 | Text := inttostr(maxvalue);
|
---|
147 | end;
|
---|
148 | end;
|
---|
149 | spnAutoSaveClick(self, btNext);
|
---|
150 | end;
|
---|
151 |
|
---|
152 | procedure TfrmOptionsNotes.txtAutoSaveKeyPress(Sender: TObject;
|
---|
153 | var Key: Char);
|
---|
154 | begin
|
---|
155 | if Key = #13 then
|
---|
156 | begin
|
---|
157 | Perform(WM_NextDlgCtl, 0, 0);
|
---|
158 | exit;
|
---|
159 | end;
|
---|
160 | if not (Key in ['0'..'9', #8]) then
|
---|
161 | begin
|
---|
162 | Key := #0;
|
---|
163 | beep;
|
---|
164 | end;
|
---|
165 | end;
|
---|
166 |
|
---|
167 | procedure TfrmOptionsNotes.txtAutoSaveExit(Sender: TObject);
|
---|
168 | begin
|
---|
169 | with txtAutoSave do
|
---|
170 | begin
|
---|
171 | if Text = '' then
|
---|
172 | begin
|
---|
173 | Text := '0';
|
---|
174 | spnAutoSaveClick(self, btNext);
|
---|
175 | end
|
---|
176 | else if (Copy(Text, 1, 1) = '0') and (length(Text) > 1) then
|
---|
177 | begin
|
---|
178 | Text := inttostr(strtointdef(Text, 0));
|
---|
179 | spnAutoSaveClick(self, btNext);
|
---|
180 | end;
|
---|
181 | end;
|
---|
182 | end;
|
---|
183 |
|
---|
184 | procedure TfrmOptionsNotes.spnAutoSaveClick(Sender: TObject;
|
---|
185 | Button: TUDBtnType);
|
---|
186 | begin
|
---|
187 | txtAutoSave.SetFocus;
|
---|
188 | txtAutoSave.Tag := strtointdef(txtAutoSave.Text, 0);
|
---|
189 | end;
|
---|
190 |
|
---|
191 | procedure TfrmOptionsNotes.cboCosignerNeedData(Sender: TObject;
|
---|
192 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
193 | begin
|
---|
194 | cboCosigner.ForDataUse(rpcGetCosigners(StartFrom, Direction));
|
---|
195 | end;
|
---|
196 |
|
---|
197 | procedure TfrmOptionsNotes.cboCosignerExit(Sender: TObject);
|
---|
198 | begin
|
---|
199 | with cboCosigner do
|
---|
200 | if (Text = '') or (ItemIndex = -1) then
|
---|
201 | begin
|
---|
202 | ItemIndex := 0;
|
---|
203 | Text := DisplayText[0];
|
---|
204 | end;
|
---|
205 | end;
|
---|
206 |
|
---|
207 | end.
|
---|