Last change
on this file since 594 was 459, checked in by Kevin Toppenberg, 16 years ago |
Adding foia-cprs branch
|
File size:
1.4 KB
|
Rev | Line | |
---|
[459] | 1 | unit fRename;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls, ORFn, ORCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 22 | function ExecuteRename(var AName: string; const APrompt: string): Boolean;
|
---|
| 23 |
|
---|
| 24 | implementation
|
---|
| 25 |
|
---|
| 26 | {$R *.DFM}
|
---|
| 27 |
|
---|
| 28 | function ExecuteRename(var AName: string; const APrompt: string): Boolean;
|
---|
| 29 | var
|
---|
| 30 | frmRename: TfrmRename;
|
---|
| 31 | begin
|
---|
| 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;
|
---|
| 51 | end;
|
---|
| 52 |
|
---|
| 53 | procedure TfrmRename.FormCreate(Sender: TObject);
|
---|
| 54 | begin
|
---|
| 55 | inherited;
|
---|
| 56 | OKPressed := False;
|
---|
| 57 | end;
|
---|
| 58 |
|
---|
| 59 | procedure TfrmRename.cmdOKClick(Sender: TObject);
|
---|
| 60 | begin
|
---|
| 61 | inherited;
|
---|
| 62 | OKPressed := True;
|
---|
| 63 | Close;
|
---|
| 64 | end;
|
---|
| 65 |
|
---|
| 66 | procedure TfrmRename.cmdCancelClick(Sender: TObject);
|
---|
| 67 | begin
|
---|
| 68 | inherited;
|
---|
| 69 | Close;
|
---|
| 70 | end;
|
---|
| 71 |
|
---|
| 72 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.