source: cprs/branches/foia-cprs/CPRS-Chart/fSignItem.pas@ 1325

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

Adding foia-cprs branch

File size: 1.6 KB
RevLine 
[459]1unit fSignItem;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, ORFn, rCore, Hash, ORCtrls;
8
9type
10 TfrmSignItem = class(TForm)
11 txtESCode: TCaptionEdit;
12 lblESCode: TLabel;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 lblText: TMemo;
16 procedure cmdOKClick(Sender: TObject);
17 procedure cmdCancelClick(Sender: TObject);
18 private
19 FESCode: string;
20 public
21 { Public declarations }
22 end;
23
24procedure SignatureForItem(FontSize: Integer; const AText, ACaption: string; var ESCode: string);
25
26implementation
27
28{$R *.DFM}
29
30const
31 TX_INVAL_MSG = 'Not a valid electronic signature code. Enter a valid code or press Cancel.';
32 TX_INVAL_CAP = 'Unrecognized Signature Code';
33
34procedure SignatureForItem(FontSize: Integer; const AText, ACaption: string; var ESCode: string);
35var
36 frmSignItem: TfrmSignItem;
37begin
38 frmSignItem := TfrmSignItem.Create(Application);
39 try
40 ResizeAnchoredFormToFont(frmSignItem);
41 with frmSignItem do
42 begin
43 FESCode := '';
44 Caption := ACaption;
45 lblText.Text := AText;
46 ShowModal;
47 ESCode := FESCode;
48 end;
49 finally
50 frmSignItem.Release;
51 end;
52end;
53
54procedure TfrmSignItem.cmdOKClick(Sender: TObject);
55begin
56 if not ValidESCode(txtESCode.Text) then
57 begin
58 InfoBox(TX_INVAL_MSG, TX_INVAL_CAP, MB_OK);
59 txtESCode.SetFocus;
60 txtESCode.SelectAll;
61 Exit;
62 end;
63 FESCode := Encrypt(txtESCode.Text);
64 Close;
65end;
66
67procedure TfrmSignItem.cmdCancelClick(Sender: TObject);
68begin
69 FESCode := '';
70 Close;
71end;
72
73end.
Note: See TracBrowser for help on using the repository browser.