pub struct FileDialog { /* private fields */ }Expand description
One file dialog, built and then shown.
Implementations§
Source§impl FileDialog
impl FileDialog
Sourcepub fn open_files() -> Self
pub fn open_files() -> Self
Choose one or more files.
Sourcepub fn open_folder() -> Self
pub fn open_folder() -> Self
Choose one folder.
Sourcepub fn open_folders() -> Self
pub fn open_folders() -> Self
Choose one or more folders.
Sourcepub fn save() -> Self
pub fn save() -> Self
Choose a path to save to. The platform asks before overwriting; the Renderer only hands back the path and never writes the file.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
The dialog’s title. Empty is the platform’s default.
Sourcepub fn directory(self, directory: impl Into<String>) -> Self
pub fn directory(self, directory: impl Into<String>) -> Self
The folder the dialog opens in. It should be absolute. One that is empty, missing or unreadable falls back to the platform’s default, and is not an error.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
The file name a save dialog starts with. Ignored by the open kinds. A path separator in it keeps only what follows the last one.
Sourcepub fn filter(self, label: impl Into<String>, extensions: &[&str]) -> Self
pub fn filter(self, label: impl Into<String>, extensions: &[&str]) -> Self
Adds a filter: a label and the extensions it allows, without dots and compared without regard to case. Ignored when choosing folders. Without any filter every file can be chosen.
Sourcepub fn default_filter(self, position: usize) -> Self
pub fn default_filter(self, position: usize) -> Self
The position of the filter selected first. A position past the last filter selects the first.
Sourcepub fn window(self, node_id: u32) -> Self
pub fn window(self, node_id: u32) -> Self
The Window node the dialog belongs to and is modal for. 0 is the implicit root
window of an application with one window.
Sourcepub fn in_window(self, window: WindowHandle) -> Self
pub fn in_window(self, window: WindowHandle) -> Self
The window the dialog belongs to, by handle.
Sourcepub fn show(self, on_result: impl FnOnce(FileDialogResult) + 'static)
pub fn show(self, on_result: impl FnOnce(FileDialogResult) + 'static)
Asks for the dialog. on_result is called once, on the UI thread, when it ends, and
is then dropped.
Call this on the UI thread, from a component or an event handler. From a worker use
FileDialogSender.