mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
Update edit example
Added top padding to dialog and a `!` to message.
This commit is contained in:
parent
abb09cf4bb
commit
c3496c9870
@ -8,12 +8,13 @@ fn main() {
|
||||
|
||||
// Create a dialog with an edit text and a button.
|
||||
siv.add_layer(Dialog::new(IdView::new("edit", EditView::new().min_length(20)))
|
||||
.padding((1,1,1,0))
|
||||
.title("Enter your name")
|
||||
.button("Ok", |s| {
|
||||
// When the button is clicked, read the text and print it in a new dialog.
|
||||
let content = {
|
||||
let name = s.find::<EditView>(&Selector::Id("edit")).unwrap().get_content();
|
||||
format!("Hello {}", name)
|
||||
format!("Hello {}!", name)
|
||||
};
|
||||
s.pop_layer();
|
||||
s.add_layer(Dialog::new(TextView::new(&content))
|
||||
|
Loading…
Reference in New Issue
Block a user