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