[456] | 1 | unit fOMVerify;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[1679] | 7 | fAutoSz, StdCtrls, ComCtrls, VA508AccessibilityManager, VA508AccessibilityRouter;
|
---|
[456] | 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmOMVerify = class(TfrmAutoSz)
|
---|
| 11 | cmdAccept: TButton;
|
---|
| 12 | cmdEdit: TButton;
|
---|
| 13 | cmdCancel: TButton;
|
---|
| 14 | memText: TRichEdit;
|
---|
[1679] | 15 | VA508ComponentAccessibility1: TVA508ComponentAccessibility;
|
---|
[456] | 16 | procedure cmdAcceptClick(Sender: TObject);
|
---|
| 17 | procedure cmdEditClick(Sender: TObject);
|
---|
| 18 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 19 | procedure FormCreate(Sender: TObject);
|
---|
| 20 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 21 | procedure memTextKeyUp(Sender: TObject; var Key: Word;
|
---|
| 22 | Shift: TShiftState);
|
---|
[1679] | 23 | procedure FormDestroy(Sender: TObject);
|
---|
| 24 | procedure VA508ComponentAccessibility1StateQuery(Sender: TObject;
|
---|
| 25 | var Text: string);
|
---|
| 26 | procedure FormShow(Sender: TObject);
|
---|
| 27 | procedure memTextKeyDown(Sender: TObject; var Key: Word;
|
---|
| 28 | Shift: TShiftState);
|
---|
[456] | 29 | private
|
---|
| 30 | FLevel: Integer;
|
---|
| 31 | end;
|
---|
| 32 |
|
---|
| 33 | procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean = False);
|
---|
| 34 |
|
---|
[1679] | 35 | var
|
---|
| 36 | frmOMVerify: TfrmOMVerify;
|
---|
[456] | 37 | implementation
|
---|
| 38 |
|
---|
| 39 | {$R *.DFM}
|
---|
| 40 |
|
---|
| 41 | uses ORFn, uConst, fFrame, rMisc, uODBase;
|
---|
| 42 |
|
---|
| 43 | procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean);
|
---|
| 44 | var
|
---|
[1679] | 45 | //frmOMVerify: TfrmOMVerify;
|
---|
[456] | 46 | tempStrs,prompts: TStringList;
|
---|
| 47 | flag: boolean;
|
---|
| 48 | HasObjects: boolean;
|
---|
| 49 |
|
---|
| 50 | function CutoffOutptPrompts(const promptIDs: TStringList; var promptList: TStringList): boolean;
|
---|
| 51 | var
|
---|
| 52 | i,j: integer;
|
---|
| 53 | begin
|
---|
| 54 | result := False;
|
---|
| 55 | for i := 0 to promptList.Count - 1 do
|
---|
| 56 | begin
|
---|
| 57 | if result = True then
|
---|
| 58 | break;
|
---|
| 59 | for j := 0 to promptIDs.Count - 1 do
|
---|
| 60 | begin
|
---|
| 61 | if Pos(promptIDs[j],LowerCase(promptList[i]))>0 then
|
---|
| 62 | begin
|
---|
| 63 | promptList.Delete(i);
|
---|
| 64 | result := True;
|
---|
| 65 | break;
|
---|
| 66 | end;
|
---|
| 67 | end;
|
---|
| 68 | end;
|
---|
| 69 | end;
|
---|
| 70 |
|
---|
| 71 | begin
|
---|
| 72 | prompts := TStringList.Create;
|
---|
| 73 | prompts.Add('supply');
|
---|
| 74 | prompts.Add('quantity');
|
---|
| 75 | prompts.Add('refill');
|
---|
| 76 | prompts.Add('pick up');
|
---|
| 77 | prompts.Add('priority');
|
---|
| 78 | frmOMVerify := TfrmOMVerify.Create(Application);
|
---|
| 79 | ResizeFormToFont(TForm(frmOMVerify));
|
---|
| 80 | if InptDispGrp then
|
---|
| 81 | begin
|
---|
| 82 | tempStrs := TStringList.Create;
|
---|
| 83 | TStrings(tempStrs).SetText(PChar(VerifyText));
|
---|
| 84 | repeat
|
---|
| 85 | flag := CutoffOutptPrompts(prompts, tempStrs);
|
---|
| 86 | until not flag;
|
---|
| 87 | SetString(VerifyText, tempStrs.GetText, StrLen(tempStrs.GetText))
|
---|
| 88 | end;
|
---|
| 89 | SetFormPosition(frmOMVerify);
|
---|
| 90 | ExpandOrderObjects(VerifyText, HasObjects);
|
---|
[1679] | 91 | frmOMVerify.memText.Lines.SetText(PChar(VerifyText));
|
---|
| 92 | frmOMVerify.ShowModal;
|
---|
| 93 | if frmOMVerify.ModalResult = mrOK then
|
---|
| 94 | begin
|
---|
| 95 | QuickLevel := frmOMVerify.FLevel;
|
---|
| 96 | end;
|
---|
| 97 | //agp on CPRS timeout ModalResult equal mrCancel this prevent starting a new order
|
---|
| 98 | //when the chart is timing out.
|
---|
| 99 | if frmOMVerify.ModalResult = mrCancel then QuickLevel := QL_CANCEL;
|
---|
| 100 | frmOMVerify.Free;
|
---|
[456] | 101 | end;
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | procedure TfrmOMVerify.FormCreate(Sender: TObject);
|
---|
| 105 | begin
|
---|
| 106 | inherited;
|
---|
[1679] | 107 | frmOMVerify := nil;
|
---|
[456] | 108 | FLevel := QL_CANCEL;
|
---|
[1679] | 109 | ModalResult := mrNone;
|
---|
[456] | 110 | end;
|
---|
| 111 |
|
---|
[1679] | 112 |
|
---|
| 113 | procedure TfrmOMVerify.FormDestroy(Sender: TObject);
|
---|
| 114 | begin
|
---|
| 115 | inherited;
|
---|
| 116 | frmOMVerify := nil;
|
---|
| 117 | end;
|
---|
| 118 |
|
---|
| 119 | procedure TfrmOMVerify.FormShow(Sender: TObject);
|
---|
| 120 | begin
|
---|
| 121 | inherited;
|
---|
| 122 | if ScreenReaderSystemActive then
|
---|
| 123 | begin
|
---|
| 124 | memText.TabStop := true;
|
---|
| 125 | memText.SetFocus;
|
---|
| 126 | end;
|
---|
| 127 | end;
|
---|
| 128 |
|
---|
[456] | 129 | procedure TfrmOMVerify.cmdAcceptClick(Sender: TObject);
|
---|
| 130 | begin
|
---|
| 131 | inherited;
|
---|
| 132 | FLevel := QL_AUTO;
|
---|
[1679] | 133 | ModalResult := mrOK;
|
---|
[456] | 134 | end;
|
---|
| 135 |
|
---|
| 136 | procedure TfrmOMVerify.cmdEditClick(Sender: TObject);
|
---|
| 137 | begin
|
---|
| 138 | inherited;
|
---|
| 139 | FLevel := QL_DIALOG;
|
---|
[1679] | 140 | ModalResult := mrOK;
|
---|
[456] | 141 | end;
|
---|
| 142 |
|
---|
| 143 | procedure TfrmOMVerify.cmdCancelClick(Sender: TObject);
|
---|
| 144 | begin
|
---|
| 145 | inherited;
|
---|
| 146 | FLevel := QL_CANCEL;
|
---|
[1679] | 147 | ModalResult := mrOK;
|
---|
[456] | 148 | end;
|
---|
| 149 |
|
---|
| 150 | procedure TfrmOMVerify.FormClose(Sender: TObject;
|
---|
| 151 | var Action: TCloseAction);
|
---|
| 152 | begin
|
---|
| 153 | inherited;
|
---|
| 154 | SaveUserBounds(Self);
|
---|
| 155 | end;
|
---|
| 156 |
|
---|
[1679] | 157 | procedure TfrmOMVerify.memTextKeyDown(Sender: TObject; var Key: Word;
|
---|
| 158 | Shift: TShiftState);
|
---|
| 159 | begin
|
---|
| 160 | inherited;
|
---|
| 161 | if ShiftTabIsPressed() then
|
---|
| 162 | begin
|
---|
| 163 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 164 | Key := 0;
|
---|
| 165 | end;
|
---|
| 166 | if TabIsPressed() then
|
---|
| 167 | begin
|
---|
| 168 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
| 169 | Key := 0;
|
---|
| 170 | end;
|
---|
| 171 | if (key = VK_ESCAPE) then begin
|
---|
| 172 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 173 | key := 0;
|
---|
| 174 | end;
|
---|
| 175 | end;
|
---|
| 176 |
|
---|
[456] | 177 | procedure TfrmOMVerify.memTextKeyUp(Sender: TObject; var Key: Word;
|
---|
| 178 | Shift: TShiftState);
|
---|
| 179 | begin
|
---|
| 180 | inherited;
|
---|
[1679] | 181 | {if (Key = VK_TAB) then
|
---|
[456] | 182 | begin
|
---|
| 183 | if ssShift in Shift then
|
---|
| 184 | begin
|
---|
| 185 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 186 | Key := 0;
|
---|
| 187 | end
|
---|
| 188 | else if ssCtrl in Shift then
|
---|
| 189 | begin
|
---|
| 190 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
| 191 | Key := 0;
|
---|
| 192 | end;
|
---|
| 193 | end;
|
---|
| 194 | if (key = VK_ESCAPE) then begin
|
---|
| 195 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 196 | key := 0;
|
---|
[1679] | 197 | end; }
|
---|
[456] | 198 | end;
|
---|
| 199 |
|
---|
[1679] | 200 | procedure TfrmOMVerify.VA508ComponentAccessibility1StateQuery(Sender: TObject;
|
---|
| 201 | var Text: string);
|
---|
| 202 | begin
|
---|
| 203 | inherited;
|
---|
| 204 | Text := memText.Text;
|
---|
| 205 | end;
|
---|
| 206 |
|
---|
[456] | 207 | end.
|
---|