1 | //kt -- Modified with SourceScanner on 8/8/2007
|
---|
2 | unit fOMVerify;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | fAutoSz, StdCtrls, ComCtrls, DKLang;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmOMVerify = class(TfrmAutoSz)
|
---|
12 | cmdAccept: TButton;
|
---|
13 | cmdEdit: TButton;
|
---|
14 | cmdCancel: TButton;
|
---|
15 | memText: TRichEdit;
|
---|
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);
|
---|
23 | private
|
---|
24 | FLevel: Integer;
|
---|
25 | end;
|
---|
26 |
|
---|
27 | procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean = False);
|
---|
28 |
|
---|
29 | implementation
|
---|
30 |
|
---|
31 | {$R *.DFM}
|
---|
32 |
|
---|
33 | uses ORFn, uConst, fFrame, rMisc, uODBase;
|
---|
34 |
|
---|
35 | procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean);
|
---|
36 | var
|
---|
37 | frmOMVerify: TfrmOMVerify;
|
---|
38 | tempStrs,prompts: TStringList;
|
---|
39 | flag: boolean;
|
---|
40 | HasObjects: boolean;
|
---|
41 |
|
---|
42 | function CutoffOutptPrompts(const promptIDs: TStringList; var promptList: TStringList): boolean;
|
---|
43 | var
|
---|
44 | i,j: integer;
|
---|
45 | begin
|
---|
46 | result := False;
|
---|
47 | for i := 0 to promptList.Count - 1 do
|
---|
48 | begin
|
---|
49 | if result = True then
|
---|
50 | break;
|
---|
51 | for j := 0 to promptIDs.Count - 1 do
|
---|
52 | begin
|
---|
53 | if Pos(promptIDs[j],LowerCase(promptList[i]))>0 then
|
---|
54 | begin
|
---|
55 | promptList.Delete(i);
|
---|
56 | result := True;
|
---|
57 | break;
|
---|
58 | end;
|
---|
59 | end;
|
---|
60 | end;
|
---|
61 | end;
|
---|
62 |
|
---|
63 | begin
|
---|
64 | prompts := TStringList.Create;
|
---|
65 | //prompts.Add('supply'); <-- original line. //kt 8/8/2007
|
---|
66 | prompts.Add(DKLangConstW('fOMVerify_supply')); //kt added 8/8/2007
|
---|
67 | //prompts.Add('quantity'); <-- original line. //kt 8/8/2007
|
---|
68 | prompts.Add(DKLangConstW('fOMVerify_quantity')); //kt added 8/8/2007
|
---|
69 | //prompts.Add('refill'); <-- original line. //kt 8/8/2007
|
---|
70 | prompts.Add(DKLangConstW('fOMVerify_refill')); //kt added 8/8/2007
|
---|
71 | //prompts.Add('pick up'); <-- original line. //kt 8/8/2007
|
---|
72 | prompts.Add(DKLangConstW('fOMVerify_pick_up')); //kt added 8/8/2007
|
---|
73 | //prompts.Add('priority'); <-- original line. //kt 8/8/2007
|
---|
74 | prompts.Add(DKLangConstW('fOMVerify_priority')); //kt added 8/8/2007
|
---|
75 | frmOMVerify := TfrmOMVerify.Create(Application);
|
---|
76 | try
|
---|
77 | ResizeFormToFont(TForm(frmOMVerify));
|
---|
78 | if InptDispGrp then
|
---|
79 | begin
|
---|
80 | tempStrs := TStringList.Create;
|
---|
81 | TStrings(tempStrs).SetText(PChar(VerifyText));
|
---|
82 | repeat
|
---|
83 | flag := CutoffOutptPrompts(prompts, tempStrs);
|
---|
84 | until not flag;
|
---|
85 | SetString(VerifyText, tempStrs.GetText, StrLen(tempStrs.GetText))
|
---|
86 | end;
|
---|
87 |
|
---|
88 | with frmOMVerify do
|
---|
89 | begin
|
---|
90 | SetBounds(frmFrame.Left, frmFrame.Top + frmFrame.Height - Height, Width, Height);
|
---|
91 | SetFormPosition(frmOMVerify);
|
---|
92 | ExpandOrderObjects(VerifyText, HasObjects);
|
---|
93 | memText.Lines.SetText(PChar(VerifyText));
|
---|
94 | ShowModal;
|
---|
95 | QuickLevel := FLevel;
|
---|
96 | end;
|
---|
97 | finally
|
---|
98 | frmOMVerify.Release;
|
---|
99 | end;
|
---|
100 | end;
|
---|
101 |
|
---|
102 |
|
---|
103 | procedure TfrmOMVerify.FormCreate(Sender: TObject);
|
---|
104 | begin
|
---|
105 | inherited;
|
---|
106 | FLevel := QL_CANCEL;
|
---|
107 | end;
|
---|
108 |
|
---|
109 | procedure TfrmOMVerify.cmdAcceptClick(Sender: TObject);
|
---|
110 | begin
|
---|
111 | inherited;
|
---|
112 | FLevel := QL_AUTO;
|
---|
113 | Close;
|
---|
114 | end;
|
---|
115 |
|
---|
116 | procedure TfrmOMVerify.cmdEditClick(Sender: TObject);
|
---|
117 | begin
|
---|
118 | inherited;
|
---|
119 | FLevel := QL_DIALOG;
|
---|
120 | Close;
|
---|
121 | end;
|
---|
122 |
|
---|
123 | procedure TfrmOMVerify.cmdCancelClick(Sender: TObject);
|
---|
124 | begin
|
---|
125 | inherited;
|
---|
126 | FLevel := QL_CANCEL;
|
---|
127 | Close;
|
---|
128 | end;
|
---|
129 |
|
---|
130 | procedure TfrmOMVerify.FormClose(Sender: TObject;
|
---|
131 | var Action: TCloseAction);
|
---|
132 | begin
|
---|
133 | inherited;
|
---|
134 | SaveUserBounds(Self);
|
---|
135 | end;
|
---|
136 |
|
---|
137 | procedure TfrmOMVerify.memTextKeyUp(Sender: TObject; var Key: Word;
|
---|
138 | Shift: TShiftState);
|
---|
139 | begin
|
---|
140 | inherited;
|
---|
141 | if (Key = VK_TAB) then
|
---|
142 | begin
|
---|
143 | if ssShift in Shift then
|
---|
144 | begin
|
---|
145 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
146 | Key := 0;
|
---|
147 | end
|
---|
148 | else if ssCtrl in Shift then
|
---|
149 | begin
|
---|
150 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
151 | Key := 0;
|
---|
152 | end;
|
---|
153 | end;
|
---|
154 | if (key = VK_ESCAPE) then begin
|
---|
155 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
156 | key := 0;
|
---|
157 | end;
|
---|
158 | end;
|
---|
159 |
|
---|
160 | end.
|
---|