1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Document and demonstrate how to expand a TextEdit to fill a Ui

This commit is contained in:
Emil Ernerfeldt
2021-05-02 21:56:59 +02:00
parent 66122e4c9a
commit 1394205f52
3 changed files with 31 additions and 2 deletions

View File

@@ -319,8 +319,17 @@ impl super::View for InputTest {
// ----------------------------------------------------------------------------
#[derive(Default)]
pub struct WindowResizeTest {}
pub struct WindowResizeTest {
text: String,
}
impl Default for WindowResizeTest {
fn default() -> Self {
Self {
text: crate::LOREM_IPSUM.to_owned(),
}
}
}
impl super::Demo for WindowResizeTest {
fn name(&self) -> &'static str {
@@ -381,5 +390,14 @@ impl super::Demo for WindowResizeTest {
ui.separator();
ui.code(crate::LOREM_IPSUM);
});
Window::new("↔ resizable with TextEdit")
.open(open)
.scroll(false)
.resizable(true)
.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));
});
}
}