mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
a22c92a1a1
Also added `examples/list_view.rs`.
28 lines
1.0 KiB
Rust
28 lines
1.0 KiB
Rust
extern crate cursive;
|
|
|
|
use cursive::Cursive;
|
|
use cursive::With;
|
|
use cursive::view::{ListView, Dialog, EditView, TextView, LinearLayout};
|
|
|
|
fn main() {
|
|
let mut siv = Cursive::new();
|
|
|
|
siv.add_layer(Dialog::new(ListView::new()
|
|
.child("Name", EditView::new().min_length(10))
|
|
.child("Email", LinearLayout::horizontal()
|
|
.child(EditView::new().min_length(15))
|
|
.child(TextView::new("@"))
|
|
.child(EditView::new().min_length(10)))
|
|
.delimiter()
|
|
.with(|list| {
|
|
for i in 0..50 {
|
|
list.add_child(&format!("Item {}", i), EditView::new());
|
|
}
|
|
})
|
|
)
|
|
.title("Please fill out this form")
|
|
.button("Ok", |s| s.quit()));
|
|
|
|
siv.run();
|
|
}
|