Please enable JavaScript to view this site.

Codolex

The open dialog file can be used to let the user select file(s) from the explorer.

uses Vcl.Dialogs.TFileOpenDialog

 

OpenDialog

Activity properties

 

begin

var ReturnList: string;

var IsExecuted: Boolean;

var FileDialog := TFileOpenDialog.Create(nil);

try  

   IsExecuted := FileDialog.Execute;

  if IsExecuted then

     ReturnList := FileDialog.FileName;

finally

   FileDialog.Free;

end;

 

end;

Resulting code

 

The value of the 'store selected file(s) in' property is dependent on the option 'multiple files'. If 'multiple files' is selected, the property expects a string list to store the selected paths in. Otherwise a string variable is expected to store the selected path in.

 

If the 'Pick folders' option is selected, only folder can be selected.

 

The 'File/Path must exist' options are selectable for validation. If the options are not selected, the user is able to type in a file/folder and select it, regardless of it exists.

 

The 'Default file path' fills the selected file name for the user.

© by GDK Software