JVCL Help: TJvSearchFiles Class
- Project summary
Search in JVCL HelpSearch in all projects
Enables you to search for files and directories.
TJvSearchFiles = class(TJvComponent);
Use TJvSearchFiles to perform a search operation for files and directories.
First use the properties of TJvSearchFiles to specify how and what to search for:
- Use RootDirectory to specify the start directory for the search.
- Use DirOption to specify whether the component must only scan the start directory, must also scan in valid - as specified by DirParams - sub-directories or must scan in all sub-directories.
- Use ErrorResponse to specify how a TJvSearchFiles component should react on errors.
- Use FileParams to specify which files are included in the search result. Include soSearchFilesin Options to actually search for files.
- Use DirParams to specify which directories are included in the search result. If DirOption is set tdoExcludeInvalidDirs or doExcludeCompleteInvalidDirs then DirParams also limits the search to sub-directories that match to the parameters specified by DirParams. Include soSearchDirs in Options to actually search for directories.
- Use Options to specify various behavioral properties of the search component.
Some work can be done by the component or by the user:
- TJvSearchFiles can store all found files and directories in Files and Directories resp., or this can be done by the user in response of OnFindFile and OnFindDirectory events. Include soOwnerData in Options to let the component not store found files and directories.
- FileParams and DirParams can be used to limit the search result to files and directories that match the parameters described by these objects, or this can be done by the user in response of the OnCheck event.
After setting these properties you can call Search to start the search operation. Now the following events will be triggered during the search operation:
- OnBeginScanDir: when the component starts scanning a directory.
- OnCheck: when the component needs to check if a file or directory is valid. If you don't write anOnCheck event handler, then the component uses the DirParams and FileParams object to determine if a file or directory is valid.
- OnFindFile: when the component finds a valid file.
- OnFindDirectory: when the component finds a valid directory.
- OnAbort: when the user aborts the search operation by calling Abort.
While searching the component updates the TotalDirectories, TotalFiles, and TotalFileSize properties, if a file or directory is found.
Eventually the search operation will end with result False, if an error occurred or the user did abort the operation, or otherwise with result True.
For examples on how to search for specific file, look here.
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page