demo: demonstrate how to prevent auto-shrinking windows

This commit is contained in:
Emil Ernerfeldt 2021-08-27 19:59:31 +02:00
parent 906a798003
commit 52193c2273

View file

@ -442,9 +442,20 @@ impl super::Demo for WindowResizeTest {
.open(open)
.scroll(false)
.resizable(true)
.default_height(300.0)
.show(ctx, |ui| {
ui.label("Shows how you can fill an area with a widget.");
ui.add_sized(ui.available_size(), TextEdit::multiline(&mut self.text));
});
Window::new("↔ freely resized")
.open(open)
.scroll(false)
.resizable(true)
.default_size([250.0, 150.0])
.show(ctx, |ui| {
ui.label("This window has empty space that fills up the available space, preventing auto-shrink.");
ui.allocate_space(ui.available_size());
});
}
}