unit DialogList;

interface

uses
  System.Classes, Vcl.Dialogs;

type
  TDialogOpen = class(TObject)
  private
    FOpenDialog: TOpenDialog;
    function GetFiles: TStrings;
    function GetFileName: string;
    procedure SetFileName(Value: string);
    function GetInitialDir: string;
    procedure SetInitialDir(Value: string);
    function GetTitle: string;
    procedure SetTitle(Value: string);

  public
    constructor Create;
    destructor Destroy; override;
    function Execute(): Boolean;
    property Files: TStrings read GetFiles;
    property FileName: string read GetFileName write SetFileName;
    property InitialDir: string read GetInitialDir write SetInitialDir;
    property Title: string read GetTitle write SetTitle;
  end;

implementation

{ TDialogOpen }

constructor TDialogOpen.Create;
begin
  FOpenDialog := TOpenDialog.Create(nil);
end;

destructor TDialogOpen.Destroy;
begin
  FOpenDialog.Free;
  inherited;
end;

function TDialogOpen.Execute: Boolean;
begin
  Result := FOpenDialog.Execute(nil);
end;

function TDialogOpen.GetFileName: string;
begin
  Result := FOpenDialog.FileName;
end;

function TDialogOpen.GetFiles: TStrings;
begin
  Result := FOpenDialog.Files;
end;

function TDialogOpen.GetInitialDir: string;
begin
  Result := FOpenDialog.InitialDir;
end;

function TDialogOpen.GetTitle: string;
begin
  Result := FOpenDialog.Title;
end;

procedure TDialogOpen.SetFileName(Value: string);
begin
  FOpenDialog.FileName := Value;
end;

procedure TDialogOpen.SetInitialDir(Value: string);
begin
  FOpenDialog.InitialDir := Value;
end;

procedure TDialogOpen.SetTitle(Value: string);
begin
  FOpenDialog.Title := Value;
end;

end.
