IFileOpenDialog.MultiSelect

Syntax

MultiSelect: Boolean;

Description

The MultiSelect property determines whether the multiple selection of files in the dialog box is possible.

Comments

If the MultiSelect property is set to True, several files of dialog box can be canceled using the SHIFT and CTRL keys.

Example

Executing the example requires a form with the Button1 button and the FileOpenDialog component named FileOpenDialog1.

Sub Button1OnClick(Sender: Object; Args: IEventArgs);
Var
    FileStr: IFileStream;
Begin
    FileOpenDialog1.MultiSelect := 
False;
    FileOpenDialog1.ShowReadOnly := 
True;
    FileOpenDialog1.ReadOnlyChecked := 
True;
    
If FileOpenDialog1.Execute Then
        
If FileOpenDialog1.ReadOnlyChecked Then
            FileStr := File.Open(FileOpenDialog1.FileName, FileOpenMode.Read, FileShare.DenyNone);
            
//...
        Else
            FileStr := File.Open(FileOpenDialog1.FileName, FileOpenMode.ReadWrite, FileShare.Exclusive);
            
//...
        End If;
        
Dispose FileStr;
    
End If;
End Sub Button1OnClick;

Clicking the button initializes the file opening dialog box. There is the Read-Only checkbox during initialization of the dialog box. Checkbox will be selected. It is possible to select only one file. On selecting a file and on clicking the OK button, depending on the state of Read-Only checkbox, this file is read-only or writable and without access to this file from other applications.

See also:

IFileOpenDialog