|
|
|
|
|
- Default extension (when creating a file with the fSelCreate constant)
- Default extension when opening a file
- Clicking a file found in the file picker
- Selecting directories
- Network drives, manifest and UAC
- Examples of file pickers
fSelect (Function) In french: fSélecteur Opens the file picker of the current system. Note: On Android and iOS, the file selection dialog box is not available. Use AlbumPicker (to select an Image or Video file) or URISelect for all types of files.
FichierSélectionné is string
FichierSélectionné = fSelect("C:\Répertoires", "Fichier.txt", ...
"Sélectionner un fichier", ...
"Fichier Texte (*.TXT)" + TAB + "*.txt" + CR + "Tous" + TAB + "*.*", "txt")
Syntax
Opening a file picker by specifying the initial directory and the file selected by default Hide the details
<Result> = fSelect(<Initial directory> , <File selected by default> , <Picker title> , <Types of files> , <Default extension> [, <Selection mode>])
<Result>: Character string - Full name of the selected files. If several files are selected, the names of the files are separated by CR characters (Carriage Return).
- Full name of the file to create.
- Empty string ("") if no file was selected or created.
<Initial directory>: Character string Full or relative path of the initial directory (up to 260 characters). This directory name may (or may not) end with "\". The files found in this directory will be displayed in the file picker. If this parameter is an empty string (""), the initial directory will be the current directory. <File selected by default>: Character string Name and extension of the file selected by default. If this parameter is an empty string (""), no file will be selected by default. <Picker title>: Character string Caption displayed in the title bar of the file picker. If this parameter is an empty string (""), the title of the current WINDEV window will be displayed. <Types of files>: Character string Description of types of files that can be selected. This description has the following format:
<Types Fichiers> + TAB + <Liste Extensions> [ + RC + ... <Types Fichiers 2> + TAB + <Liste Extensions 2>] Where:- <Types Fichiers> string describing file type ("BMP (*.BMP;*.RLE)" for example).
- <Liste Extensions> extensions corresponding to the type described ("*.BMP;*.RLE" for example).
For example: "BMP (*.BMP;*.RLE)"+TAB+"*.BMP;*.RLE"+CR+"Icon (*.ICO)"+TAB+"*.ICO"+CR+"Other"+TAB+"*.GIF;*.TIF;*.JPG" <Default extension>: Character string Extension assigned by default to the selected file (see the Notes). <Selection mode>: Optional constant (or combination of constants) Used to define the selection mode of the picker: | | fselChange | Sends the MessageSelect message to the calling WINDEV window whenever a click is performed on a file found in the file picker. | fselCreate | Opens the file picker in creation mode ("Save" button). | fselExist | If this constant is combined:- with fselCrée: Returns the name of the selected file. If the file already exists, a dialog box displays and allows the user to overwrite the former file.
- with fselOuvre: Returns the name of the selected file only if it exists.
| fselMulti | Opens the file picker in multi-selection mode. The user can select several files by pressing the "Ctrl" and "Shift" keys. | fselOpen | Opens the file picker in opening mode ("Open" button). | fUnicodePath | <Result> will be a Unicode string. |
By default, the file picker is called by fselOpen + fselExist.
Opening a file picker by specifying the file selected by default Hide the details
<Result> = fSelect(<Full path of the file selected by default> , <Picker title> , <Types of files> , <Default extension> [, <Selection mode>])
<Result>: Character string - Full name of the selected files. If several files are selected, the names of the files are separated by CR characters (Carriage Return).
- Full name of the file to create.
- Empty string ("") if no file was selected or created.
<Full path of the file selected by default>: Character string Full (or relative) path of the file selected by default (including the file name and its extension. If this parameter is an empty string (""), the initial directory will be the current directory and no file will be selected by default. <Picker title>: Character string Caption displayed in the title bar of the file picker. If this parameter is an empty string (""), the title of the current WINDEV window will be displayed. <Types of files>: Character string Description of types of files that can be selected. This description has the following format:
<Types Fichiers> + TAB + <Liste Extensions> [ + RC + ... <Types Fichiers 2> + TAB + <Liste Extensions 2>]
- <Types Fichiers> string describing file type ("BMP (*.BMP;*.RLE)" for example).
- <Liste Extensions> extensions corresponding to the type described ("*.BMP;*.RLE" for example).
For example: "BMP (*.BMP;*.RLE)"+TAB+"*.BMP;*.RLE"+CR+"Icon (*.ICO)"+TAB+"*.ICO"+CR+"Other"+TAB+"*.GIF;*.TIF;*.JPG" <Default extension>: Character string Extension assigned by default to the selected file (see the Notes). <Selection mode>: Optional constant (or combination of constants) Used to define the selection mode of the picker: | | fselChange | Sends the MessageSelect message to the calling WINDEV window whenever a click is performed on a file found in the file picker. | fselCreate | Opens the file picker in creation mode ("Save" button). | fselExist | If this constant is combined:- with fselCrée: Returns the name of the selected file. If the file already exists, a dialog box displays and allows the user to overwrite the former file.
- with fselOuvre: Returns the name of the selected file only if it exists.
| fselMulti | Opens the file picker in multi-selection mode. The user can select several files by pressing the "Ctrl" and "Shift" keys. | fselOpen | Opens the file picker in opening mode ("Open" button). | fUnicodePath | <Result> will be a Unicode string. |
By default, the file picker is called by fselOpen + fselExist. Remarks Default extension (when creating a file with the fSelCreate constant) The extension of a selected file (file to create) differs according to: - <Default extension>,
- the extension entered by the user.
For example, the table below presents the extension that will be taken into account according to <Default extension> and to the extension entered by the user: | | | <Default extension> | Extension entered by the user | Extension taken into account when creating the file |
---|
".TXT" | "File.BMP" BMP is a valid and recognized extension. | "File.BMP" | ".TXT" | "File.PAF" PAF is an invalid extension. The name of the file will be completed by the <Default extension>. | "File.PAF.TXT" | ".TXT" | "File" No extension is entered. The <Default extension> is used. | "File.TXT" | "" (empty string) | "File.BMP" BMP is a valid and recognized extension. | "File.BMP" | "" (empty string) | "File.PAF" PAF is an invalid extension. The name of the file will be completed by the first extension found in the "Type of file" displayed. Type of file displayed: "Text (*.TXT;*.DOC)". | "File.PAF.TXT" | "" (empty string) | "File.PAF" PAF is an invalid extension. The type of the file being "*.*", the invalid extension is kept. Type of file displayed: "All files (*.*)". | "File.PAF" | "" (empty string) | "File" No extension is entered. The extension used is the first extension found in the "Type of file" displayed. Type of file displayed: "Text (*.TXT;*.DOC)". | "File.TXT" | "" (empty string) | "File" No extension is entered. The type of the file being "*.*", the name of the file is kept without extension. Type of file displayed: "All files (*.*)". | "File" |
Default extension when opening a file The extension of a selected file (file to open) corresponds to the extension selected by default when opening the file picker. <Default extension> must correspond to the letters corresponding to the extension ("lst" to select "*.lst" by default). Clicking a file found in the file picker To run a specific process when clicking a file found in the file picker, branch an event on the message WM_USER + 600 (1624). When this message is received: - the lParam variable contains the address of the selected file
- the wParam variable contains the address of the selected file.
For example, you have the ability to play the sound selected in the file picker (see Example 2, available by clicking the "Example" link at the top of help page). Selecting directories fSelect is used to select files. To select a directory, use fSelectDir. Business / UI classification: UI Code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|