Skip to main content

TextEdit

Struct TextEdit 

Source
pub struct TextEdit { /* private fields */ }
Expand description

Represents field where user can input their own text

let mut text_edit = TextEdit::new("First Name".to_owned());
let slot = SlotImpl::new();
text_edit.signal_text_changed().connect_slot(&slot);

// Whenewer TextEdit's text will be changed then `slot` will be triggered

§Macros

[u_textedit!] simplifies TextEdit creation:

let slot = SlotImpl::new();

let text_edit = u_textedit!{
    placeholder: "First Name",
    signal_text_changed: slot,
};

Implementations§

Source§

impl TextEdit

Source

pub fn new(placeholder: String) -> TextEdit

Creates new TextEdit with provided placeholder. You may be interested in [u_textedit!] to simplify TextEdit creation/setup.

let label = TextEdit::new("First Name".to_owned());
Source

pub fn signal_text_changed(&mut self) -> &mut Signal<String>

The signal will trigger all connected slots whenever TextEdit’s text will be changed

let mut text_edit = u_textedit!{
    placeholder: "First Name".to_owned(),
};

let slot = SlotImpl::new();

// Or concider to use u_textedit!'s signal_text_changed parameter
text_edit.signal_text_changed().connect_slot(&slot);

// Whenever text will be changed, the `slot` will be triggered
Source

pub fn slot_set_text(&mut self) -> &mut dyn Slot<String>

Slot to change TextEdit’s text

let text_edit = u_textedit!{
    placeholder: "First Name".to_owned(),
};

let mut signal = Signal::new();
signal.connect_slot(text_edit.slot_set_text());

// <...>

signal.emit("John".to_owned());
// text_edit's text will be set to "John"

Trait Implementations§

Source§

impl DataProcessor for TextEdit

Source§

fn process_data(&mut self, _: i64, _: &mut dyn UiPageContext)

Will be called by crate::Application time to time Read more
Source§

impl Widget for TextEdit

Source§

fn to_native( &mut self, widget_generator: &mut dyn WidgetGenerator, ) -> Result<NativeWidget, ()>

Generate native widget
Source§

fn draw(&mut self)

Allows drawing on top of generated NativeWidget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.