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

@@ -817,6 +817,8 @@ impl Ui {
/// Add a [`Widget`] to this `Ui` with a given size.
/// The widget will attempt to fit within the given size, but some widgets may overflow.
///
/// To fill all remaining area, use `ui.add_sized(ui.available_size(), widget);`
///
/// See also [`Self::add`] and [`Self::put`].
///
/// ```

View File

@@ -125,6 +125,15 @@ impl CCursorPair {
/// // …
/// }
/// ```
///
/// To fill an [`Ui`] with a [`TextEdit`] use [`Ui::add_sized`]:
///
/// ```
/// # let mut ui = egui::Ui::__test();
/// # let mut my_string = String::new();
/// ui.add_sized(ui.available_size(), egui::TextEdit::multiline(&mut my_string));
/// ```
///
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
#[derive(Debug)]
pub struct TextEdit<'t> {