source: cprs/branches/foia-cprs/CPRS-Chart/fProbCmt.pas@ 1328

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

Adding foia-cprs branch

File size: 2.0 KB
RevLine 
[459]1unit fProbCmt;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 ORCtrls, StdCtrls, Buttons;
8
9type
10 TfrmProbCmt = class(TForm)
11 edComment: TCaptionEdit;
12 bbOK: TBitBtn;
13 bbCancel: TBitBtn;
14 lblComment: TOROffsetLabel;
15 procedure bbCancelClick(Sender: TObject);
16 procedure bbOKClick(Sender: TObject);
17 private
18 fCmtResult: string ;
19 end;
20
21function NewComment: string ;
22function EditComment(OldValue: string): string ;
23
24
25var
26 frmProbCmt: TfrmProbCmt;
27
28implementation
29
30uses
31 uProbs, ORfn, rCore ;
32
33const
34 TX_INVALID_CHAR = 'The character "^" cannot be used in a comment';
35 TC_INVALID_CHAR = 'Invalid character';
36
37{$R *.DFM}
38
39function NewComment: string ;
40begin
41 frmProbCmt := TfrmProbCmt.Create(Application) ;
42 try
43 ResizeAnchoredFormToFont(frmProbCmt);
44 with frmProbCmt do
45 begin
46 ShowModal;
47 Result := fCmtResult;
48 end;
49 finally
50 frmProbCmt.Free ;
51 end ;
52end ;
53
54function EditComment(OldValue: string): string ;
55begin
56 frmProbCmt := TfrmProbCmt.Create(Application) ;
57 try
58 with frmProbCmt do
59 begin
60 edComment.Text := Piece(OldValue, U, 2);
61 ShowModal;
62 Result := fCmtResult;
63 end;
64 finally
65 frmProbCmt.Free ;
66 end ;
67end ;
68
69
70procedure TfrmProbCmt.bbCancelClick(Sender: TObject);
71begin
72 fCmtResult := '0^Cancelled' ;
73end;
74
75procedure TfrmProbCmt.bbOKClick(Sender: TObject);
76begin
77 if (edComment.Text <> '') then
78 begin
79 if Pos('^', edComment.Text) > 0 then
80 begin
81 InfoBox(TX_INVALID_CHAR, TC_INVALID_CHAR, MB_ICONERROR);
82 fCmtResult := '';
83 ModalResult := mrNone;
84 end
85 else
86 begin
87 fCmtResult := '1^'+FormatFMDateTime('mmm dd yyyy',FMToday)+'^'+ edComment.Text;
88 ModalResult := mrOK;
89 end;
90 end
91 else
92 begin
93 fCmtResult := '';
94 ModalResult := mrNone;
95 end;
96end;
97
98end.
Note: See TracBrowser for help on using the repository browser.