MultiSelect: Boolean;
The MultiSelect property determines whether multiple of can be selected in the dialog box.
If the MultiSelect property is set to True, multiple files can be selected in the dialog box using the SHIFT and CTRL keys.
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: