1 | //kt -- Modified with SourceScanner on 7/24/2007
|
---|
2 | unit fProbCmt;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | ORCtrls, StdCtrls, Buttons, DKLang;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmProbCmt = class(TForm)
|
---|
12 | edComment: TCaptionEdit;
|
---|
13 | bbOK: TBitBtn;
|
---|
14 | bbCancel: TBitBtn;
|
---|
15 | lblComment: TOROffsetLabel;
|
---|
16 | DKLanguageController1: TDKLanguageController;
|
---|
17 | procedure bbCancelClick(Sender: TObject);
|
---|
18 | procedure bbOKClick(Sender: TObject);
|
---|
19 | private
|
---|
20 | fCmtResult: string ;
|
---|
21 | end;
|
---|
22 |
|
---|
23 | function NewComment: string ;
|
---|
24 | function EditComment(OldValue: string): string ;
|
---|
25 |
|
---|
26 |
|
---|
27 | var
|
---|
28 | frmProbCmt: TfrmProbCmt;
|
---|
29 |
|
---|
30 | implementation
|
---|
31 |
|
---|
32 | uses
|
---|
33 | uProbs, ORfn, rCore ;
|
---|
34 |
|
---|
35 | {$R *.DFM}
|
---|
36 |
|
---|
37 | //const
|
---|
38 | //TX_INVALID_CHAR = 'The character "^" cannot be used in a comment'; <-- original line. //kt 7/24/2007
|
---|
39 | //TC_INVALID_CHAR = 'Invalid character'; <-- original line. //kt 7/24/2007
|
---|
40 |
|
---|
41 | var
|
---|
42 | TX_INVALID_CHAR : string; //kt
|
---|
43 | TC_INVALID_CHAR : string; //kt
|
---|
44 |
|
---|
45 | procedure SetupVars;
|
---|
46 | //kt Added entire function to replace constant declarations 7/24/2007
|
---|
47 | begin
|
---|
48 | TX_INVALID_CHAR := DKLangConstW('fProbCmt_The_character_xxx_cannot_be_used_in_a_comment');
|
---|
49 | TC_INVALID_CHAR := DKLangConstW('fProbCmt_Invalid_character');
|
---|
50 | end;
|
---|
51 |
|
---|
52 | function NewComment: string ;
|
---|
53 | begin
|
---|
54 | frmProbCmt := TfrmProbCmt.Create(Application) ;
|
---|
55 | try
|
---|
56 | ResizeAnchoredFormToFont(frmProbCmt);
|
---|
57 | with frmProbCmt do
|
---|
58 | begin
|
---|
59 | ShowModal;
|
---|
60 | Result := fCmtResult;
|
---|
61 | end;
|
---|
62 | finally
|
---|
63 | frmProbCmt.Free ;
|
---|
64 | end ;
|
---|
65 | end ;
|
---|
66 |
|
---|
67 | function EditComment(OldValue: string): string ;
|
---|
68 | begin
|
---|
69 | frmProbCmt := TfrmProbCmt.Create(Application) ;
|
---|
70 | try
|
---|
71 | with frmProbCmt do
|
---|
72 | begin
|
---|
73 | edComment.Text := Piece(OldValue, U, 2);
|
---|
74 | ShowModal;
|
---|
75 | Result := fCmtResult;
|
---|
76 | end;
|
---|
77 | finally
|
---|
78 | frmProbCmt.Free ;
|
---|
79 | end ;
|
---|
80 | end ;
|
---|
81 |
|
---|
82 |
|
---|
83 | procedure TfrmProbCmt.bbCancelClick(Sender: TObject);
|
---|
84 | begin
|
---|
85 | fCmtResult := '0^Cancelled' ;
|
---|
86 | end;
|
---|
87 |
|
---|
88 | procedure TfrmProbCmt.bbOKClick(Sender: TObject);
|
---|
89 | begin
|
---|
90 | SetupVars; //kt added 7/24/2007 to replace constants with vars.
|
---|
91 | if (edComment.Text <> '') then
|
---|
92 | begin
|
---|
93 | if Pos('^', edComment.Text) > 0 then
|
---|
94 | begin
|
---|
95 | InfoBox(TX_INVALID_CHAR, TC_INVALID_CHAR, MB_ICONERROR);
|
---|
96 | fCmtResult := '';
|
---|
97 | ModalResult := mrNone;
|
---|
98 | end
|
---|
99 | else
|
---|
100 | begin
|
---|
101 | fCmtResult := '1^'+FormatFMDateTime('mmm dd yyyy',FMToday)+'^'+ edComment.Text;
|
---|
102 | ModalResult := mrOK;
|
---|
103 | end;
|
---|
104 | end
|
---|
105 | else
|
---|
106 | begin
|
---|
107 | fCmtResult := '';
|
---|
108 | ModalResult := mrNone;
|
---|
109 | end;
|
---|
110 | end;
|
---|
111 |
|
---|
112 | end.
|
---|