Struct native_windows_gui::FileDialog [−][src]
pub struct FileDialog { /* fields omitted */ }Expand description
A file dialog control
The file dialog builders accepts the following parameters:
- title: The title of the dialog
- action: The action to execute. Open, OpenDirectory for Save
- multiselect: Whether the user can select more than one file. Only supported with the Open action
- default_folder: Default folder to show in the dialog.
- filters: If defined, filter the files that the user can select (In a Open dialog) or which extension to add to the saved file (in a Save dialog)
The
filtersvalue must be a ‘|’ separated string having this format: “Test(.txt;.rs)|Any(.)”
use native_windows_gui as nwg;
fn layout(dialog: &mut nwg::FileDialog) {
nwg::FileDialog::builder()
.title("Hello")
.action(nwg::FileDialogAction::Open)
.multiselect(true)
.build(dialog);
}Implementations
Return the action type executed by this dialog
Display the dialog. Return true if the dialog was accepted or false if it was cancelled
If the dialog was accepted, get_selected_item or get_selected_items can be used to find the selected file(s)
It’s important to note that run blocks the current thread until the user as chosen a file (similar to dispatch_thread_events)
The parent argument must be a window control otherwise the method will panic.
Return the item selected in the dialog by the user.
Failures:
• if the dialog was not called
• if there was a system error while reading the selected item
• if the dialog has the multiselect flag
Return the selected items in the dialog by the user.
Failures:
• if the dialog was not called
• if there was a system error while reading the selected items
• if the dialog has Save for action
Return true if the dialog accepts multiple values or false otherwise
Set the multiselect flag of the dialog.
Failures:
• if there was a system error while setting the new flag value
• if the dialog has Save for action
Set the first opened folder when the dialog is shown. This value is overriden by the user after the dialog ran.
Call clear_client_data to fix that.
Failures:
• if the default folder do not identify a folder
• if the folder do not exists
Filter the files that the user can select (In a Open dialog) in the dialog or which extension to add to the saved file (in a Save dialog).
This can only be set ONCE (the initialization counts) and won’t work if the dialog is OpenDirectory.
The filters value must be a ‘|’ separated string having this format: “Test(.txt;.rs)|Any(.)”
Where the fist part is the “human name” and the second part is a filter for the system.
Instructs the dialog to clear all persisted state information (such as the last folder visited).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FileDialogimpl !Send for FileDialogimpl !Sync for FileDialogimpl Unpin for FileDialogimpl UnwindSafe for FileDialog