source: cprs/trunk/CPRS-Chart/fRename.pas@ 808

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 1.4 KB
Line 
1unit fRename;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, StdCtrls, ORFn, ORCtrls;
8
9type
10 TfrmRename = class(TfrmAutoSz)
11 lblRename: TLabel;
12 txtName: TCaptionEdit;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 procedure FormCreate(Sender: TObject);
16 procedure cmdOKClick(Sender: TObject);
17 procedure cmdCancelClick(Sender: TObject);
18 private
19 OKPressed: Boolean;
20 end;
21
22function ExecuteRename(var AName: string; const APrompt: string): Boolean;
23
24implementation
25
26{$R *.DFM}
27
28function ExecuteRename(var AName: string; const APrompt: string): Boolean;
29var
30 frmRename: TfrmRename;
31begin
32 Result := False;
33 frmRename := TfrmRename.Create(Application);
34 try
35 ResizeFormToFont(TForm(frmRename));
36 with frmRename do
37 begin
38 lblRename.Caption := APrompt;
39 txtName.Text := AName;
40 txtName.SelectAll;
41 ShowModal;
42 if OKPressed then
43 begin
44 AName := txtName.Text;
45 Result := True;
46 end;
47 end;
48 finally
49 frmRename.Release;
50 end;
51end;
52
53procedure TfrmRename.FormCreate(Sender: TObject);
54begin
55 inherited;
56 OKPressed := False;
57end;
58
59procedure TfrmRename.cmdOKClick(Sender: TObject);
60begin
61 inherited;
62 OKPressed := True;
63 Close;
64end;
65
66procedure TfrmRename.cmdCancelClick(Sender: TObject);
67begin
68 inherited;
69 Close;
70end;
71
72end.
Note: See TracBrowser for help on using the repository browser.