unit dirdlg;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, FileCtrl, Buttons;

type
  TOpenDirDlg = class(TForm)
    DriveComboBox1: TDriveComboBox;
    Label1: TLabel;
    DirectoryListBox1: TDirectoryListBox;
    OpenButton: TButton;
    CancelButton: TButton;
    NewSpeedButton: TSpeedButton;
    UpSpeedButton: TSpeedButton;
    procedure DriveComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    function Execute : Boolean;
    function Directory : String;
  end;

var
  OpenDirDlg: TOpenDirDlg;

implementation

{$R *.DFM}

procedure TOpenDirDlg.DriveComboBox1Change(Sender: TObject);
begin
   DirectoryListBox1.Drive := DriveComboBox1.Drive;
end;

function TOpenDirDlg.Execute : Boolean;
begin
   try
      if ShowModal = mrOK then
      begin
         Result := True;
      end
      else
      begin
         Result := False;
      end;
   except
      Hide;
      DriveComboBox1.Drive := 'C';
      if ShowModal = mrOK then
      begin
         Result := True;
      end
      else
      begin
         Result := False;
      end;
   end;
end;

function TOpenDirDlg.Directory : String;
begin
   Result := DirectoryListBox1.Directory;
end;

end.
