[453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007
|
---|
| 2 | unit fOrderComment;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 8 | fAutoSz, StdCtrls, ComCtrls, ORFn, rOrders, DKLang;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 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 |
|
---|
| 26 | function ExecuteWardComments(AnOrder: TOrder): Boolean;
|
---|
| 27 |
|
---|
| 28 | implementation
|
---|
| 29 |
|
---|
| 30 | {$R *.DFM}
|
---|
| 31 |
|
---|
| 32 | //const
|
---|
| 33 | //TC_PUT_ERR = 'Unable to Save Comments'; <-- original line. //kt 8/8/2007
|
---|
| 34 |
|
---|
| 35 | var
|
---|
| 36 | TC_PUT_ERR : string; //kt
|
---|
| 37 |
|
---|
| 38 | procedure SetupVars;
|
---|
| 39 | //kt Added entire function to replace constant declarations 8/8/2007
|
---|
| 40 | begin
|
---|
| 41 | TC_PUT_ERR := DKLangConstW('fOrderComment_Unable_to_Save_Comments');
|
---|
| 42 | end;
|
---|
| 43 |
|
---|
| 44 | function ExecuteWardComments(AnOrder: TOrder): Boolean;
|
---|
| 45 | var
|
---|
| 46 | frmWardComments: TfrmWardComments;
|
---|
| 47 | ErrMsg: string;
|
---|
| 48 | begin
|
---|
| 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;
|
---|
| 69 | end;
|
---|
| 70 |
|
---|
| 71 | procedure TfrmWardComments.FormCreate(Sender: TObject);
|
---|
| 72 | begin
|
---|
| 73 | inherited;
|
---|
| 74 | OKPressed := False;
|
---|
| 75 | end;
|
---|
| 76 |
|
---|
| 77 | procedure TfrmWardComments.cmdOKClick(Sender: TObject);
|
---|
| 78 | begin
|
---|
| 79 | inherited;
|
---|
| 80 | OKPressed := True;
|
---|
| 81 | Close;
|
---|
| 82 | end;
|
---|
| 83 |
|
---|
| 84 | procedure TfrmWardComments.cmdCancelClick(Sender: TObject);
|
---|
| 85 | begin
|
---|
| 86 | inherited;
|
---|
| 87 | Close;
|
---|
| 88 | end;
|
---|
| 89 |
|
---|
| 90 | procedure TfrmWardComments.memCommentsKeyUp(Sender: TObject; var Key: Word;
|
---|
| 91 | Shift: TShiftState);
|
---|
| 92 | begin
|
---|
| 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;
|
---|
| 111 | end;
|
---|
| 112 |
|
---|
| 113 | end.
|
---|