TOpenDialog.CheckFile function
Ensures the specified file name meets the requirements for the dialog.
Declaration
function CheckFile(var AFilename: string): Boolean; virtualArguments
AFilename | Fully-qualified file name or directory path examined and possibly updated in the method. |
Function result
True if the file name is valid for the open dialog.Description
CheckFile is a Boolean function used to examine and update the
specified file name. AFilename is a variable argument which contains the path
to the file and can include its extension. The return value is
True if
the file name satisfies the filter, extension, and options used for the open
dialog.
Values in DefaultExt, Filter, and FilterIndex are used to get a file extension when AFilename does not already include one. The file extension is appended to the value in AFilename.
Values in Options are used to determine if the file name is usable, including:
- ofPathMustExist
- The path in AFilename must already exist on the local file system. If it does not exist, a rsfdPathNoExist message is displayed and the method is exited.
- ofFileMustExist
- Calls CheckFileMustExist to ensure that the file already exists on the local file system. A message is displayed if the file name and extension are not found, and the method is exited.
- ofNoReadOnlyReturn
- The file and / or directory in AFilename must be writable. A rsfdFileReadOnly is displayed if the file or directory is read-only, and the method is exited.
CheckFile is used in the CheckAllFiles method to validate the entries in the Files property.
Modified in LCL version 2.2.6 to include an additional helper function (ExtractFilterValues) in the implementation.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
