Struct egui::widgets::TextEdit[][src]

#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]pub struct TextEdit<'t> { /* fields omitted */ }

A text region that the user can edit the contents of.

Example:

let response = ui.add(egui::TextEdit::singleline(&mut my_string));
if response.lost_kb_focus() {
    // use my_string
}

Implementations

impl<'t> TextEdit<'t>[src]

pub fn new(text: &'t mut String) -> Self[src]

👎 Deprecated:

Use TextEdit::singleline or TextEdit::multiline (or the helper ui.text_edit_singleline, ui.text_edit_multiline) instead

pub fn singleline(text: &'t mut String) -> Self[src]

Now newlines (\n) allowed. Pressing enter key will result in the TextEdit loosing focus (response.lost_kb_focus).

pub fn multiline(text: &'t mut String) -> Self[src]

A TextEdit for multiple lines. Pressing enter key will create a new line.

pub fn id(mut self: Self, id: Id) -> Self[src]

pub fn id_source(mut self: Self, id_source: impl Hash) -> Self[src]

A source for the unique Id, e.g. .id_source("second_text_edit_field") or .id_source(loop_index).

pub fn hint_text(mut self: Self, hint_text: impl Into<String>) -> Self[src]

Show a faint hint text when the text field is empty.

pub fn text_style(mut self: Self, text_style: TextStyle) -> Self[src]

pub fn text_color(mut self: Self, text_color: Color32) -> Self[src]

pub fn text_color_opt(mut self: Self, text_color: Option<Color32>) -> Self[src]

pub fn enabled(mut self: Self, enabled: bool) -> Self[src]

Default is true. If set to false then you cannot edit the text.

pub fn frame(mut self: Self, frame: bool) -> Self[src]

Default is true. If set to false there will be no frame showing that this is editable text!

pub fn desired_width(mut self: Self, desired_width: f32) -> Self[src]

Set to 0.0 to keep as small as possible

pub fn desired_rows(mut self: Self, desired_height_rows: usize) -> Self[src]

Set the number of rows to show by default. The default for singleline text is 1. The default for multiline text is 4.

Trait Implementations

impl<'t> Debug for TextEdit<'t>[src]

impl<'t> Widget for TextEdit<'t>[src]

Auto Trait Implementations

impl<'t> RefUnwindSafe for TextEdit<'t>[src]

impl<'t> Send for TextEdit<'t>[src]

impl<'t> Sync for TextEdit<'t>[src]

impl<'t> Unpin for TextEdit<'t>[src]

impl<'t> !UnwindSafe for TextEdit<'t>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.