mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Document and demonstrate how to expand a TextEdit to fill a Ui
This commit is contained in:
@@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user