aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorReyk Floeter <reyk.floeter@googlemail.com>2019-12-10 15:24:36 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-12-10 19:56:09 +0100
commit2f3e2b5474834e3d733edf09b831c5607d451f49 (patch)
tree4b94e0e6874ae300f595e8dd9bffd06aec867543 /examples
parent3b76a0a46ce38eef7fe3e5a969cec6ffee47f227 (diff)
downloaddialog-rs-2f3e2b5474834e3d733edf09b831c5607d451f49.tar.gz
dialog-rs-2f3e2b5474834e3d733edf09b831c5607d451f49.tar.bz2
Add FileSelection dialog type
This patch adds the FileSelection struct representing a file selection dialog. It can be displayed using the backend’s show_file_selection function. Currently, we only support file open dialogs (i. e. choosing an existing file). Support for save dialogs should be added in the future.
Diffstat (limited to 'examples')
-rw-r--r--examples/file_selection.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/file_selection.rs b/examples/file_selection.rs
new file mode 100644
index 0000000..5436742
--- /dev/null
+++ b/examples/file_selection.rs
@@ -0,0 +1,13 @@
+// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
+// SPDX-License-Identifier: MIT
+
+use dialog::DialogBox;
+
+fn main() -> dialog::Result<()> {
+ let choice = dialog::FileSelection::new("Please select a file")
+ .title("File Chooser Example")
+ .path("/etc")
+ .show()?;
+ println!("The user chose: {:?}", choice);
+ Ok(())
+}