OSDN Git Service

Implementation finished
authornaru <bottle@mikage.to>
Wed, 15 Jan 2003 14:24:22 +0000 (14:24 +0000)
committernaru <bottle@mikage.to>
Wed, 15 Jan 2003 14:24:22 +0000 (14:24 +0000)
bottleclient/OpenFileEditor.dfm
bottleclient/OpenFileEditor.pas

index 973e495..174bd46 100755 (executable)
@@ -1,7 +1,7 @@
 object frmOpenFileEditor: TfrmOpenFileEditor
   Left = 458
   Top = 546
-  Width = 428
+  Width = 419
   Height = 129
   Caption = #12501#12449#12452#12523#12398#25351#23450
   Color = clBtnFace
@@ -28,18 +28,18 @@ object frmOpenFileEditor: TfrmOpenFileEditor
     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
@@ -49,7 +49,7 @@ object frmOpenFileEditor: TfrmOpenFileEditor
     TabOrder = 2
   end
   object btnOk: TButton
-    Left = 344
+    Left = 336
     Top = 64
     Width = 67
     Height = 25
@@ -58,7 +58,7 @@ object frmOpenFileEditor: TfrmOpenFileEditor
     ModalResult = 1
     TabOrder = 3
   end
-  object OpenDialog1: TOpenDialog
+  object OpenDialog: TOpenDialog
     Left = 16
     Top = 64
   end
index 8dd5b80..13427d2 100755 (executable)
@@ -8,12 +8,13 @@ uses
 
 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
@@ -23,8 +24,36 @@ type
 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.