OPENFILEDIALOG$: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Initial version) |
No edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_OPENFILEDIALOG$}} | {{DISPLAYTITLE:_OPENFILEDIALOG$}} | ||
The '''_OPENFILEDIALOG$''' function displays a standard dialog box that prompts the user to open a file. The returned string is an empty string ('''""''') if the user cancelled. The returned string will contain file paths delimited using '''"|"''' if allowMultipleSelects& is passed as '' | The '''_OPENFILEDIALOG$''' function displays a standard dialog box that prompts the user to open a file. The returned string is an empty string ('''""''') if the user cancelled. The returned string will contain file paths delimited using '''"|"''' if allowMultipleSelects& is passed as ''true(-1)'' and multiple files are selected by the user. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:{{Parameter|result | :{{Parameter|result$}} = [[_OPENFILEDIALOG$]]([{{Parameter|title$}}][, {{Parameter|defaultPathAndFile$}}][, {{parameter|filterPatterns$}}][, {{Parameter|singleFilterDescription$}}][, {{Parameter|allowMultipleSelects&}}]) | ||
Line 11: | Line 11: | ||
* {{Parameter|defaultPathAndFile$}} is the default path that will be used by the dialog box if not changed by the user | * {{Parameter|defaultPathAndFile$}} is the default path that will be used by the dialog box if not changed by the user | ||
* {{parameter|filterPatterns$}} are the file filters separated using '''"|"''' (e.g., "*.png|*.jpg|*.gif") | * {{parameter|filterPatterns$}} are the file filters separated using '''"|"''' (e.g., "*.png|*.jpg|*.gif") | ||
* {{Parameter|singleFilterDescription$}} is the single filter description (e.g. "Image files") | * {{Parameter|singleFilterDescription$}} is the single filter description (e.g., "Image files") | ||
* {{Parameter|allowMultipleSelects&}} can be '' | * {{Parameter|allowMultipleSelects&}} can be ''false(0)'' or ''true(-1)'' if multiple file selection is to be allowed. If omitted, then this defaults to ''false(0)'' | ||
Line 22: | Line 22: | ||
{{PageAvailability}} | {{PageAvailability}} | ||
* '''QB64-PE v3.4 and up''' | * '''QB64-PE v3.4.0 and up''' | ||
Line 37: | Line 37: | ||
* [[_MESSAGEBOX]] | * [[_MESSAGEBOX]] | ||
* [[_MESSAGEBOX (function)]] | * [[_MESSAGEBOX (function)]] | ||
* [[_INPUTBOX$]] | |||
* [[_SELECTFOLDERDIALOG$]] | * [[_SELECTFOLDERDIALOG$]] | ||
* [[ | * [[_COLORCHOOSERDIALOG]] | ||
* [[_SAVEFILEDIALOG$]] | * [[_SAVEFILEDIALOG$]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 00:35, 18 November 2024
The _OPENFILEDIALOG$ function displays a standard dialog box that prompts the user to open a file. The returned string is an empty string ("") if the user cancelled. The returned string will contain file paths delimited using "|" if allowMultipleSelects& is passed as true(-1) and multiple files are selected by the user.
Syntax
- result$ = _OPENFILEDIALOG$([title$][, defaultPathAndFile$][, filterPatterns$][, singleFilterDescription$][, allowMultipleSelects&])
Parameters
- title$ is the dialog box title
- defaultPathAndFile$ is the default path that will be used by the dialog box if not changed by the user
- filterPatterns$ are the file filters separated using "|" (e.g., "*.png|*.jpg|*.gif")
- singleFilterDescription$ is the single filter description (e.g., "Image files")
- allowMultipleSelects& can be false(0) or true(-1) if multiple file selection is to be allowed. If omitted, then this defaults to false(0)
Description
- All parameters accept an empty string ("") in which case system defaults are used
- If singleFilterDescription$ is an empty string (""), then filterPatterns$ will be shown in it's place
- The dialog box automatically becomes a modal window if the application window is visible
Availability
- QB64-PE v3.4.0 and up
Examples
- Example
- Simple open file dialog example
audiofiles$ = _OPENFILEDIALOG$("Open File", "", "*.mp3|*.ogg|*.wav|*.flac", "Audio files", -1) IF audiofiles$ <> "" THEN _MESSAGEBOX "Information", "You selected " + audiofiles$ |
See also
- _NOTIFYPOPUP
- _MESSAGEBOX
- _MESSAGEBOX (function)
- _INPUTBOX$
- _SELECTFOLDERDIALOG$
- _COLORCHOOSERDIALOG
- _SAVEFILEDIALOG$