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 cancelled using SHIFT and CTRL keys.

Example

Executing the example requires a form, a button named Button1 positioned on it 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;

After executing the example pressing the button initializes the dialog of file opening. There is the Read-only flag during initialization of the dialog. This flag is selected. It is possible to select only one file. When the user selects a file and presses OK button, depending on the state of Read-only flag, this file is read-only or writable and without access to this file from other applications.

See also:

IFileOpenDialog