wxFileDialog(3)
π wxFileDialog β okay bestie, listen π
so this is a page from the Erlang module definition docs, and it's all about wxFileDialog, the class that represents the file chooser dialog. yes, the "pick a file" window. the one everyone's seen. iconic behavior honestly. π
β¨ NAME β¨
wxFileDialog β this class represents the file chooser dialog. ποΈβ¨
πΈ DESCRIPTION πΈ
okay so buckle up, this part is lowkey important. π«Ά
The path and filename are distinct elements of a full file pathname. So like, they're not the same thing, don't @ me.
- If path is
?wxEmptyString, the current directory will be used. - If filename is
?wxEmptyString, no default filename will be supplied.
The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension for the required filename. π
The typical usage for the open file dialog is:
The typical usage for the save file dialog is instead somewhat simpler:
Remark: All implementations of thewxFileDialogprovide a wildcard filter. Typing a filename containing wildcards (,?) in the filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed. The wildcard may be a specification for multiple types of file with a description for each, such as: It must be noted that wildcard support in the native Motif file dialog is quite limited: only one file type is supported, and it is displayed without the descriptive test;"BMP files (.bmp)|.bmp"is displayed as".bmp", and both"BMP files (.bmp)|.bmp|GIF files (.gif)|.gif"and"Image files|.bmp;.gif"are errors. On Mac macOS in the open file dialog the filter choice box is not shown by default. Instead all given wildcards are appplied at the same time: So in the above example all bmp, gif and png files are displayed. To enforce the display of the filter choice set the correspondingwxSystemOptionsbefore calling the file open dialog: But in contrast to Windows and Unix, where the file type choice filters only the selected files, on Mac macOS even in this case the dialog shows all files matching all file types. The files which does not match the currently selected file type are greyed out and are not selectable. ππ
π¦ Styles π¦
This class supports the following styles, and yes, we're listing every single one because they all matter: β
wxFD_DEFAULT_STYLEβ Equivalent towxFD_OPEN. β¨wxFD_OPENβ This is an open dialog; usually this means that the default button's label of the dialog is"Open". Cannot be combined withwxFD_SAVE. πwxFD_SAVEβ This is a save dialog; usually this means that the default button's label of the dialog is"Save". Cannot be combined withwxFD_OPEN. πΎwxFD_OVERWRITE_PROMPTβ For save dialog only: prompt for a confirmation if a file will be overwritten. β οΈwxFD_NO_FOLLOWβ Directs the dialog to return the path and file name of the selected shortcut file, not its target as it does by default. Currently this flag is only implemented inwxMSWandwxOSX(where it prevents aliases from being resolved). The non-dereferenced link path is always returned, even without this flag, under Unix and so using it there doesn't do anything. This flag was added in wxWidgets 3.1.0. πwxFD_FILE_MUST_EXISTβ For open dialog only: the user may only select files that actually exist. Notice that under macOS the file dialog withwxFD_OPENstyle always behaves as if this style was specified, because it is impossible to choose a file that doesn't exist from a standard macOS file dialog. πwxFD_MULTIPLEβ For open dialog only: allows selecting multiple files. π«ΆwxFD_CHANGE_DIRβ Change the current working directory (when the dialog is dismissed) to the directory where the file(s) chosen by the user are. πwxFD_PREVIEWβ Show the preview of the selected files (currently only supported bywxGTK). πwxFD_SHOW_HIDDENβ Show hidden files. This flag was added in wxWidgets 3.1.3 π»
π See: π
- Overview
cmndlg ?wxFileSelector()
This class is derived, and can use functions, from:
wxDialogwxTopLevelWindowwxWindowwxEvtHandler
wxWidgets docs: wxFileDialog π
π DATA TYPES π
wxFileDialog() :: wx:wx_object().
that's the whole section. short king. π
π₯ FUNCTIONS π₯
destroy
destroy(This :: wxFileDialog()) -> ok.
Destroys the object π β say bye bestie, it's gone.
getDirectory
getDirectory(This) -> unicode:charlist()
when This :: wxFileDialog().
Returns the default directory. π
getFilename
getFilename(This) -> unicode:charlist()
when This :: wxFileDialog().
Returns the default filename.
Note: This function can't be used with dialogs which have thewxFD_MULTIPLEstyle, usegetFilenames/1instead. π«
getFilenames
getFilenames(This) -> [unicode:charlist()]
when This :: wxFileDialog().
Fills the array filenames with the names of the files chosen.
This function should only be used with the dialogs which have wxFD_MULTIPLE style, use getFilename/1 for the others.
Note that under Windows, if the user selects shortcuts, the filenames include paths, since the application cannot determine the full path of each referenced file by appending the directory containing the shortcuts to the filename. πͺ
getFilterIndex
getFilterIndex(This) -> integer() when This :: wxFileDialog().
Returns the index into the list of filters supplied, optionally, in the wildcard parameter.
Before the dialog is shown, this is the index which will be used when the dialog is first displayed. π¬
After the dialog is shown, this is the index selected by the user. π
getMessage
getMessage(This) -> unicode:charlist() when This :: wxFileDialog().
Returns the message that will be displayed on the dialog. π¬
getPath
getPath(This) -> unicode:charlist() when This :: wxFileDialog().
Returns the full path (directory and filename) of the selected file. π£οΈ
Note: This function can't be used with dialogs which have thewxFD_MULTIPLEstyle, usegetPaths/1instead. π«
getPaths
getPaths(This) -> [unicode:charlist()] when This :: wxFileDialog().
Fills the array paths with the full paths of the files chosen.
This function should only be used with the dialogs which have wxFD_MULTIPLE style, use getPath/1 for the others. β¨
getWildcard
getWildcard(This) -> unicode:charlist()
when This :: wxFileDialog().
Returns the file dialog wildcard. π
new
new(Parent, [Option]) -> wxFileDialog()
when
Parent :: wxWindow:wxWindow(),
Option ::
{message, unicode:chardata()} |
{defaultDir, unicode:chardata()} |
{defaultFile, unicode:chardata()} |
{wildCard, unicode:chardata()} |
{style, integer()} |
{pos, {X :: integer(), Y :: integer()}} |
{sz, {W :: integer(), H :: integer()}}.
Constructor. ποΈ
Use wxDialog:showModal/1 to show the dialog.
setDirectory
setDirectory(This, Directory) -> ok
when
This :: wxFileDialog(),
Directory :: unicode:chardata().
Sets the default directory. πβ¨
setFilename
setFilename(This, Setfilename) -> ok
when
This :: wxFileDialog(),
Setfilename :: unicode:chardata().
Sets the default filename.
In wxGTK this will have little effect unless a default directory has previously been set. π§
setFilterIndex
setFilterIndex(This, FilterIndex) -> ok
when
This :: wxFileDialog(),
FilterIndex :: integer().
Sets the default filter index, starting from zero. 0οΈβ£
setMessage
setMessage(This, Message) -> ok
when
This :: wxFileDialog(),
Message :: unicode:chardata().
Sets the message that will be displayed on the dialog. π¬
setPath
setPath(This, Path) -> ok
when This :: wxFileDialog(), Path ::
unicode:chardata().
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed). π£οΈ
setWildcard
setWildcard(This, WildCard) -> ok
when
This :: wxFileDialog(),
WildCard :: unicode:chardata().
Sets the wildcard, which can contain multiple file types, for example: "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". π
Note: that the native Motif dialog has some limitations with respect to wildcards; see the Remarks section above. π¨
and that's the whole page bestie, you ate that π β¨
so yeah, this whole thing is from Ericsson AB, wx 2.6, page wxFileDialog(3) β mwah, go pick some files, slay, periodt. ππ¦π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms