[829] | 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
|
---|
[1693] | 34 | FStartingCosigner: Int64;
|
---|
[829] | 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);
|
---|
[1693] | 101 | FStartingCosigner := cosigner;
|
---|
[829] | 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
|
---|
[1693] | 129 | if FStartingCosigner <> ItemIEN then
|
---|
[829] | 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);
|
---|
| 146 | if strtointdef(Text, 0) > maxvalue then
|
---|
| 147 | Text := inttostr(maxvalue);
|
---|
| 148 | end;
|
---|
| 149 | end;
|
---|
| 150 | spnAutoSaveClick(self, btNext);
|
---|
| 151 | end;
|
---|
| 152 |
|
---|
| 153 | procedure TfrmOptionsNotes.txtAutoSaveKeyPress(Sender: TObject;
|
---|
| 154 | var Key: Char);
|
---|
| 155 | begin
|
---|
| 156 | if Key = #13 then
|
---|
| 157 | begin
|
---|
| 158 | Perform(WM_NextDlgCtl, 0, 0);
|
---|
| 159 | exit;
|
---|
| 160 | end;
|
---|
| 161 | if not (Key in ['0'..'9', #8]) then
|
---|
| 162 | begin
|
---|
| 163 | Key := #0;
|
---|
| 164 | beep;
|
---|
| 165 | end;
|
---|
| 166 | end;
|
---|
| 167 |
|
---|
| 168 | procedure TfrmOptionsNotes.txtAutoSaveExit(Sender: TObject);
|
---|
| 169 | begin
|
---|
| 170 | with txtAutoSave do
|
---|
| 171 | begin
|
---|
| 172 | if Text = '' then
|
---|
| 173 | begin
|
---|
| 174 | Text := '0';
|
---|
| 175 | spnAutoSaveClick(self, btNext);
|
---|
| 176 | end
|
---|
| 177 | else if (Copy(Text, 1, 1) = '0') and (length(Text) > 1) then
|
---|
| 178 | begin
|
---|
| 179 | Text := inttostr(strtointdef(Text, 0));
|
---|
| 180 | spnAutoSaveClick(self, btNext);
|
---|
| 181 | end;
|
---|
| 182 | end;
|
---|
| 183 | end;
|
---|
| 184 |
|
---|
| 185 | procedure TfrmOptionsNotes.spnAutoSaveClick(Sender: TObject;
|
---|
| 186 | Button: TUDBtnType);
|
---|
| 187 | begin
|
---|
| 188 | txtAutoSave.SetFocus;
|
---|
| 189 | txtAutoSave.Tag := strtointdef(txtAutoSave.Text, 0);
|
---|
| 190 | end;
|
---|
| 191 |
|
---|
| 192 | procedure TfrmOptionsNotes.cboCosignerNeedData(Sender: TObject;
|
---|
| 193 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 194 | begin
|
---|
| 195 | cboCosigner.ForDataUse(rpcGetCosigners(StartFrom, Direction));
|
---|
| 196 | end;
|
---|
| 197 |
|
---|
| 198 | procedure TfrmOptionsNotes.cboCosignerExit(Sender: TObject);
|
---|
| 199 | begin
|
---|
| 200 | with cboCosigner do
|
---|
| 201 | if (Text = '') or (ItemIndex = -1) then
|
---|
| 202 | begin
|
---|
| 203 | ItemIndex := 0;
|
---|
| 204 | Text := DisplayText[0];
|
---|
| 205 | end;
|
---|
| 206 | end;
|
---|
| 207 |
|
---|
| 208 | end.
|
---|