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:
@@ -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`].
|
||||
///
|
||||
/// ```
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user