[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'FileCtrl' (#lcl)

# TCustomFileListBox.UpdateFileList

Loads the list of files and/or directories for the list box control.

## Declaration

Source position: filectrl.pp line 71

`public procedure TCustomFileListBox.UpdateFileList; virtual;`

## Description

UpdateFileList is a method used to load the list of file and/or directory names in the Items for the control. No actions are performed in the method at design-time, or when the component is being loaded using the LCL streaming mechanism.

UpdateFileList calls Clear to remove any existing values in the Items property.

Values in FileType are used to construct file attributes needed for use with TSearchRec. The FindFirstUTF8 and FindNextUTF8 routines from LazFileUtils are used to find matching file or directory names in the Directory for the control. Each value returned for the TSearchRec is compared to the Mask and FileType defined in the control. Acceptable values are added to the Items property.

Please note that Directory names (included when FileType contains ftDirectory) are surrounded by square brackets ('[]') when added to the Items property.

The private UpdateSelectedFileName method is called to include path information in FileName for the selected item in the control.

UpdateFileList is called in the implementation of the Create and Loaded methods. It is also called when a new value is assigned to Drive, Directory, FileType, or Mask.

## See also

TCustomFileListBox.Directory |  | The Directory or Folder in which the file is located.
TCustomFileListBox.FileName |  | FileName - the name of the selected file.
TCustomFileListBox.FileType |  | FileType - the type or attributes of the selected file.
TCustomListBox.Items |  | The list of all items defined in the control.
TCustomListBox.Clear |  | Removes all items from the list box control.