Will display a interactive file selection dialog box. The dialog does use its own detached window but is aware of its parent program window, hence closing the parent window will close the FileSelect dialog too. The user may navigate through the file structure using the mouse or by directly typing/pasting content into the string fields. Optionally the filenames can be matched against a regular expression based name pattern to narrow down the displayed file lists, pattern matching doesn't affect drawer names.
Note that regular expressions are very experimental within the older (pre-2019) QB64 versions and therefore not enabled by default. If you wanna use regex matching, then you must explicitly enable it in file dev_framework\GuiAppFrame.h, but first carefully read the comments at the top of that file and then, if you're really sure, uncomment the #define GTREGEX line by removing the leading //.
SYNTAX:
filespec$ = FileSelect$ (winIcon$, winTitle$, opMode%, iniDir$, iniFile$)
INPUTS:
winIcon$ (STRING)
- The filename of any image to use as the dialog window's header icon, you don't need to specify a path for images located in the ImageClass search tree. Give an empty string to use the default icon as set in SetupScreen().
winTitle$ (STRING)
- The title for the dialog window. If you give an empty string, then it defaults either to "Select a drawer ..." for fsmDIRS% mode or "Select a file ..." for the modes fsmLOAD% and fsmSAVE%.
opMode% (INTEGER)
- Any of the operation mode constants defined in the global CONSTs section in the dev_framework\GuiAppFrame.bi file (see also below).
iniDir$ (STRING)
- The initial drawer in which to start the file navigation in. This can be a relative path according to the current work drawer. You may also give an empty string, then it will restore to the last active drawer from a former FileSelect$() call or to the current work drawer, if this is the first call.
iniFile$ (STRING)
- This is an initial filename, depending on opMode% it is handled in different ways:
- In fsmLOAD% mode, if the given file is found in the current drawer listing, then its name is highlighted automatically for immediate selection, otherwise the given name is discarded.
- In fsmSAVE% mode it is used to preset a default save filename.
- In fsmDIRS% mode this input has no effect and is ignored.
RESULT:
filespec$ (STRING)
- This also depends on the actually used opMode%:
- For fsmLOAD% and fsmSAVE% modes this is the finally chosen filename inclusive its full qualified absolute path, ie. starting with the driver letter.
- In fsmDIRS% mode it will be the finally selected full qualified absolute path ending with a trailing backslash.
- The result may also be empty, if the user did close the FileSelect dialog without a selection, either by pressing <Esc> or clicking the "Cancel" button or by closing the dialog window via the "X" button.
MODE CONSTANTS:
fsmLOAD%
- The most regular mode to request a filename for loading.
fsmSAVE%
- This is a special mode to get a filename for saving. It works almost the same way as fsmLOAD%, but without the double click or <Enter> press quick selection (to avoid random unintended selection), the user must explicitly confirm the chosen filename by clicking the Select button. Also new folders can be easily created in this mode by type/append its name into the path string input field.
fsmDIRS%
- Another special mode to select a directory only instead of a file, eg. to request a default directory for loading/saving.