DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


SelectMultiFile

Declaration: SelectMultiFile(InitialDir, Filter, Caption: string; FileList: TStringList): integer;
Opens the Windows file selection dialog in the multi-file selection mode. The parameter InitialDir controls the directory which is initially displayed. Assigning an empty string to this parameter forces the open dialog to show the working directory of DataLab. The Filter parameter is a sort of a wildcard filter to narrow down the visible files (for example, assigning '*.idt' only shows DataLab data files, or '*.*' shows all available files). The Caption parameter determines the text in the title bar of the dialog.

The list of selected files (including the full path) is returned in the string list FileList. The function returns the following error codes:

>0 ... the string list FileList is valid, the returned number is equal to the number of selected files
-1 ... the user cancelled the dialog, the FileList is left unchanged

Hint: Please note that the FileList parameter is a 0-based array of strings (the first filename is stored in FileList[0]).

Sample Program: The following short example shows how to select and process several files at once. The SelectMultiFile dialog lets the user select more than one file and returns the selected filenames in a string list:
program MultiFileSelect;

var
  i              : integer;
  FNum           : integer;
  FileList       : TStringList;

begin
FileList := TStringList.Create;
FNum := SelectMultiFile (GetDLabDir(ddWork), '*.idt',
                         'Select files', FileList);
if FNum > 0 then
  begin
  for i:=1 to FNum do
    couts (FileList[i-1]);
  end;
FileList.Free;
end.