From ec84c425282c3fd26f5e862b7864ad2ae7ec1e2e Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 8 Jan 2019 03:16:20 +0000 Subject: 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. --- examples/input.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/input.rs (limited to 'examples') 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 +// 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(()) +} -- cgit v1.2.3