source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fOrderComment.pas@ 895

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 2.7 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fOrderComment;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, DKLang;
9
10type
11 TfrmWardComments = class(TfrmAutoSz)
12 Label1: TLabel;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 memOrder: TMemo;
16 memComments: TRichEdit;
17 procedure FormCreate(Sender: TObject);
18 procedure cmdOKClick(Sender: TObject);
19 procedure cmdCancelClick(Sender: TObject);
20 procedure memCommentsKeyUp(Sender: TObject; var Key: Word;
21 Shift: TShiftState);
22 private
23 OKPressed: Boolean;
24 end;
25
26function ExecuteWardComments(AnOrder: TOrder): Boolean;
27
28implementation
29
30{$R *.DFM}
31
32//const
33//TC_PUT_ERR = 'Unable to Save Comments'; <-- original line. //kt 8/8/2007
34
35var
36 TC_PUT_ERR : string; //kt
37
38procedure SetupVars;
39//kt Added entire function to replace constant declarations 8/8/2007
40begin
41 TC_PUT_ERR := DKLangConstW('fOrderComment_Unable_to_Save_Comments');
42end;
43
44function ExecuteWardComments(AnOrder: TOrder): Boolean;
45var
46 frmWardComments: TfrmWardComments;
47 ErrMsg: string;
48begin
49 SetupVars; //kt added 8/8/2007 to replace constants with vars.
50 Result := False;
51 frmWardComments := TfrmWardComments.Create(Application);
52 try
53 ResizeFormToFont(TForm(frmWardComments));
54 with frmWardComments do
55 begin
56 memOrder.SetTextBuf(PChar(AnOrder.Text));
57 LoadWardComments(memComments.Lines, AnOrder.ID);
58 ShowModal;
59 if OKPressed then
60 begin
61 PutWardComments(memComments.Lines, AnOrder.ID, ErrMsg);
62 if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TC_PUT_ERR, MB_OK);
63 Result := True;
64 end;
65 end;
66 finally
67 frmWardComments.Release;
68 end;
69end;
70
71procedure TfrmWardComments.FormCreate(Sender: TObject);
72begin
73 inherited;
74 OKPressed := False;
75end;
76
77procedure TfrmWardComments.cmdOKClick(Sender: TObject);
78begin
79 inherited;
80 OKPressed := True;
81 Close;
82end;
83
84procedure TfrmWardComments.cmdCancelClick(Sender: TObject);
85begin
86 inherited;
87 Close;
88end;
89
90procedure TfrmWardComments.memCommentsKeyUp(Sender: TObject; var Key: Word;
91 Shift: TShiftState);
92begin
93 inherited;
94 if (Key = VK_TAB) then
95 begin
96 if ssShift in Shift then
97 begin
98 FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
99 Key := 0;
100 end
101 else if ssCtrl in Shift then
102 begin
103 FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
104 Key := 0;
105 end;
106 end;
107 if (key = VK_ESCAPE) then begin
108 FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
109 key := 0;
110 end;
111end;
112
113end.
Note: See TracBrowser for help on using the repository browser.