source: cprs/branches/tmg-cprs/CPRS-Chart/fProbCmt.pas@ 1725

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 2.5 KB
Line 
1//kt -- Modified with SourceScanner on 7/24/2007
2unit fProbCmt;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 ORCtrls, StdCtrls, Buttons, DKLang;
9
10type
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
23function NewComment: string ;
24function EditComment(OldValue: string): string ;
25
26
27var
28 frmProbCmt: TfrmProbCmt;
29
30implementation
31
32uses
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
41var
42 TX_INVALID_CHAR : string; //kt
43 TC_INVALID_CHAR : string; //kt
44
45procedure SetupVars;
46//kt Added entire function to replace constant declarations 7/24/2007
47begin
48 TX_INVALID_CHAR := DKLangConstW('fProbCmt_The_character_xxx_cannot_be_used_in_a_comment');
49 TC_INVALID_CHAR := DKLangConstW('fProbCmt_Invalid_character');
50end;
51
52function NewComment: string ;
53begin
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 ;
65end ;
66
67function EditComment(OldValue: string): string ;
68begin
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 ;
80end ;
81
82
83procedure TfrmProbCmt.bbCancelClick(Sender: TObject);
84begin
85 fCmtResult := '0^Cancelled' ;
86end;
87
88procedure TfrmProbCmt.bbOKClick(Sender: TObject);
89begin
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;
110end;
111
112end.
Note: See TracBrowser for help on using the repository browser.