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
impl TextEdit
Sourcepub fn new(placeholder: String) -> TextEdit
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());Sourcepub fn signal_text_changed(&mut self) -> &mut Signal<String>
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 triggeredSourcepub fn slot_set_text(&mut self) -> &mut dyn Slot<String>
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
impl DataProcessor for TextEdit
Source§fn process_data(&mut self, _: i64, _: &mut dyn UiPageContext)
fn process_data(&mut self, _: i64, _: &mut dyn UiPageContext)
Will be called by crate::Application time to time Read more
Auto Trait Implementations§
impl !RefUnwindSafe for TextEdit
impl !Send for TextEdit
impl !Sync for TextEdit
impl !UnwindSafe for TextEdit
impl Freeze for TextEdit
impl Unpin for TextEdit
impl UnsafeUnpin for TextEdit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more