source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fOMVerify.pas@ 1442

Last change on this file since 1442 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.3 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fOMVerify;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ComCtrls, DKLang;
9
10type
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
27procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean = False);
28
29implementation
30
31{$R *.DFM}
32
33uses ORFn, uConst, fFrame, rMisc, uODBase;
34
35procedure ShowVerifyText(var QuickLevel: Integer; var VerifyText: string; InptDispGrp: boolean);
36var
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
63begin
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;
100end;
101
102
103procedure TfrmOMVerify.FormCreate(Sender: TObject);
104begin
105 inherited;
106 FLevel := QL_CANCEL;
107end;
108
109procedure TfrmOMVerify.cmdAcceptClick(Sender: TObject);
110begin
111 inherited;
112 FLevel := QL_AUTO;
113 Close;
114end;
115
116procedure TfrmOMVerify.cmdEditClick(Sender: TObject);
117begin
118 inherited;
119 FLevel := QL_DIALOG;
120 Close;
121end;
122
123procedure TfrmOMVerify.cmdCancelClick(Sender: TObject);
124begin
125 inherited;
126 FLevel := QL_CANCEL;
127 Close;
128end;
129
130procedure TfrmOMVerify.FormClose(Sender: TObject;
131 var Action: TCloseAction);
132begin
133 inherited;
134 SaveUserBounds(Self);
135end;
136
137procedure TfrmOMVerify.memTextKeyUp(Sender: TObject; var Key: Word;
138 Shift: TShiftState);
139begin
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;
158end;
159
160end.
Note: See TracBrowser for help on using the repository browser.