[−][src]Struct egui::widgets::TextEdit
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(self, id: Id) -> Self
[src]
pub fn id_source(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 text_style(self, text_style: TextStyle) -> Self
[src]
pub fn text_color(self, text_color: Srgba) -> Self
[src]
pub fn text_color_opt(self, text_color: Option<Srgba>) -> Self
[src]
pub fn enabled(self, enabled: bool) -> Self
[src]
Default is true
. If set to false
then you cannot edit the text.
pub fn desired_width(self, desired_width: f32) -> Self
[src]
Set to 0.0 to keep as small as possible
pub fn desired_rows(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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,