aboutsummaryrefslogtreecommitdiff
path: root/examples/file_selection.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-12-10 20:09:59 +0100
committerRobin Krahl <robin.krahl@ireas.org>2019-12-10 20:09:59 +0100
commitaa8148b958daac4b35173a1d28806b2fdc8609bd (patch)
treed3c438f91a911f8e4bd0fb96dc833edaac4f21e6 /examples/file_selection.rs
parent10462c2c9f4ae2ffd3c32dd4628e0052067c15fa (diff)
parent202c49a327b7a3dc3bfa199da2ac7484ee105f65 (diff)
downloaddialog-rs-master.tar.gz
dialog-rs-master.tar.bz2
Merge branch 'release-v0.3.0'HEADmaster
Diffstat (limited to 'examples/file_selection.rs')
-rw-r--r--examples/file_selection.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/file_selection.rs b/examples/file_selection.rs
new file mode 100644
index 0000000..5d2d860
--- /dev/null
+++ b/examples/file_selection.rs
@@ -0,0 +1,21 @@
+// 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 (Open)")
+ .path("/etc")
+ .show()?;
+ println!("The user chose: {:?}", choice);
+
+ let choice = dialog::FileSelection::new("Please select a file")
+ .title("File Chooser Example (Save)")
+ .mode(dialog::FileSelectionMode::Save)
+ .path("/etc")
+ .show()?;
+ println!("The user chose: {:?}", choice);
+
+ Ok(())
+}