object frmOpenFileEditor: TfrmOpenFileEditor
Left = 458
Top = 546
- Width = 428
+ Width = 419
Height = 129
Caption = #12501#12449#12452#12523#12398#25351#23450
Color = clBtnFace
Width = 313
Height = 20
TabOrder = 0
- Text = 'edtFile'
end
object btnBrowse: TButton
- Left = 336
+ Left = 328
Top = 24
Width = 75
Height = 25
Caption = #21442#29031'(&B)'
TabOrder = 1
+ OnClick = btnBrowseClick
end
object btnCancel: TButton
- Left = 256
+ Left = 248
Top = 64
Width = 81
Height = 25
TabOrder = 2
end
object btnOk: TButton
- Left = 344
+ Left = 336
Top = 64
Width = 67
Height = 25
ModalResult = 1
TabOrder = 3
end
- object OpenDialog1: TOpenDialog
+ object OpenDialog: TOpenDialog
Left = 16
Top = 64
end
type
TfrmOpenFileEditor = class(TForm)
- OpenDialog1: TOpenDialog;
+ OpenDialog: TOpenDialog;
edtFile: TEdit;
btnBrowse: TButton;
btnCancel: TButton;
btnOk: TButton;
lblFile: TLabel;
+ procedure btnBrowseClick(Sender: TObject);
private
{ Private \90é\8c¾ }
public
var
frmOpenFileEditor: TfrmOpenFileEditor;
+function OpenFileEdit(FileName: String; Options: TOpenOptions): boolean; overload;
+function OpenFileEdit(FileName: String): boolean; overload;
+
implementation
{$R *.dfm}
+function OpenFileEdit(FileName: String; Options: TOpenOptions): boolean; overload;
+var AForm: TfrmOpenFileEditor;
+begin
+ Application.CreateForm(TfrmOpenFileEditor, AForm);
+ try
+ with AForm do begin
+ OpenDialog.Options := Options;
+ edtFile.Text := FileName;
+ Result := ShowModal = mrOk;
+ end;
+ finally
+ AForm.Release;
+ end;
+end;
+
+function OpenFileEdit(FileName: String): boolean; overload;
+begin
+ Result := OpenFileEdit(FileName, []);
+end;
+
+procedure TfrmOpenFileEditor.btnBrowseClick(Sender: TObject);
+begin
+ if OpenDialog.Execute then edtFile.Text := OpenDialog.FileName;
+end;
+
end.