summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/input.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/input.rs b/examples/input.rs
new file mode 100644
index 0000000..bb36fb6
--- /dev/null
+++ b/examples/input.rs
@@ -0,0 +1,22 @@
+// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
+// SPDX-License-Identifier: MIT
+
+use std::io::Result;
+
+use dialog::DialogBox;
+
+fn main() -> Result<()> {
+ let input1 = dialog::Input::new("Please enter something").show()?;
+ let input2 = dialog::Input::new("Please enter something")
+ .title("Input form")
+ .show()?;
+ let input3 = dialog::Input::new("Please enter something with a default")
+ .title("Input form")
+ .default("input")
+ .show()?;
+
+ println!("Input 1: {:?}", input1);
+ println!("Input 2: {:?}", input2);
+ println!("Input 3: {:?}", input3);
+ Ok(())
+}