aboutsummaryrefslogtreecommitdiff
path: root/examples/input.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-08 03:16:20 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-08 04:54:20 +0100
commitec84c425282c3fd26f5e862b7864ad2ae7ec1e2e (patch)
tree347baad0fc42290ab5da2330d828f284d1ee8d88 /examples/input.rs
parent1c76a540d647f351e27498e6f2135ff404853693 (diff)
downloaddialog-rs-ec84c425282c3fd26f5e862b7864ad2ae7ec1e2e.tar.gz
dialog-rs-ec84c425282c3fd26f5e862b7864ad2ae7ec1e2e.tar.bz2
Add input dialog boxes
This patch implements input dialog boxes. This required some refactoring in the dialog backend to allow additional arguments after the width and the height.
Diffstat (limited to 'examples/input.rs')
-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(())
+}