Fix linear example

This commit is contained in:
Alexandre Bury 2018-06-23 19:00:08 -07:00
parent fda4bae8d6
commit 9043b177e9

View File

@ -2,7 +2,7 @@ extern crate cursive;
use cursive::align::HAlign; use cursive::align::HAlign;
use cursive::traits::*; use cursive::traits::*;
use cursive::views::{Dialog, DummyView, LinearLayout, TextView}; use cursive::views::{Dialog, DummyView, LinearLayout, ScrollView, TextView};
use cursive::Cursive; use cursive::Cursive;
// This example uses a LinearLayout to stick multiple views next to each other. // This example uses a LinearLayout to stick multiple views next to each other.
@ -23,11 +23,11 @@ fn main() {
// Use a DummyView as spacer // Use a DummyView as spacer
.child(DummyView.fixed_height(1)) .child(DummyView.fixed_height(1))
// Disabling scrollable means the view cannot shrink. // Disabling scrollable means the view cannot shrink.
.child(TextView::new(text).scrollable(false)) .child(TextView::new(text))
// The other views will share the remaining space. // The other views will share the remaining space.
.child(TextView::new(text)) .child(ScrollView::new(TextView::new(text)))
.child(TextView::new(text)) .child(ScrollView::new(TextView::new(text)))
.child(TextView::new(text)) .child(ScrollView::new(TextView::new(text)))
.fixed_width(30), .fixed_width(30),
).button("Quit", |s| s.quit()) ).button("Quit", |s| s.quit())
.h_align(HAlign::Center), .h_align(HAlign::Center),