[−][src]Struct native_windows_gui::TextInput
An edit control is a rectangular control window to permit the user to enter and edit text by typing on the keyboard
This control only allow a single line input. For block of text, use TextBox
.
Winapi documentation: https://docs.microsoft.com/en-us/windows/win32/controls/about-edit-controls#text-and-input-styles
TextInput is not behind any features.
Builder parameters:
parent
: Required. The text input parent container.text
: The text input text.size
: The text input size.position
: The text input position.flags
: A combination of the TextInputFlags values.font
: The font used for the text input textlimit
: The maximum number of character that can be inserted in the controlreadonly
: If the text input should allow user input or notpassword
: The password character. If set to None, the textinput is a regular control.align
: The alignment of the text in the text inputbackground_color
: The color of the textinput top and bottom padding. This is not the white background under the text.focus
: The control receive focus after being created
Control events:
OnTextInput
: When a TextInput value is changedMousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel event
use native_windows_gui as nwg; fn build_box(tbox: &mut nwg::TextInput, window: &nwg::Window, font: &nwg::Font) { nwg::TextInput::builder() .text("Hello") .font(Some(font)) .parent(window) .build(tbox); }
Fields
handle: ControlHandle
Implementations
impl TextInput
[src]
pub fn builder<'a>() -> TextInputBuilder<'a>
[src]
pub fn font(&self) -> Option<Font>
[src]
Return the font of the control
pub fn set_font(&self, font: Option<&Font>)
[src]
Set the font of the control
pub fn password_char(&self) -> Option<char>
[src]
Return the password character displayed by the text input. If the input is not a password, return None.
pub fn set_password_char(&self, c: Option<char>)
[src]
Set or Remove the password character displayed by the text input. If the input is not a password all character are re-rendered with the new character
pub fn limit(&self) -> u32
[src]
Return the number of maximum character allowed in this text input
pub fn set_limit(&self, limit: usize)
[src]
Set the number of maximum character allowed in this text input
If limit
is 0, the text length is set to 0x7FFFFFFE characters
pub fn modified(&self) -> bool
[src]
Check if the content of the text input was modified after it's creation
pub fn set_modified(&self, e: bool)
[src]
Manually set modified flag of the text input
pub fn undo(&self)
[src]
Undo the last action by the user in the control
pub fn selection(&self) -> Range<u32>
[src]
Return the selected range of characters by the user in the text input
pub fn set_selection(&self, r: Range<u32>)
[src]
Return the selected range of characters by the user in the text input
pub fn len(&self) -> u32
[src]
Return the length of the user input in the control. This is better than input.text().len()
as it
does not allocate a string in memory
pub fn readonly(&self) -> bool
[src]
Return true if the TextInput value cannot be edited. Retrurn false otherwise. A user can still copy text from a readonly TextEdit (unlike disabled)
pub fn set_readonly(&self, r: bool)
[src]
Set the readonly flag of the text input A user can still copy text from a readonly TextEdit (unlike disabled)
pub fn focus(&self) -> bool
[src]
Return true if the control currently has the keyboard focus
pub fn set_focus(&self)
[src]
Set the keyboard focus on the button
pub fn enabled(&self) -> bool
[src]
Return true if the control user can interact with the control, return false otherwise
pub fn set_enabled(&self, v: bool)
[src]
Enable or disable the control
pub fn visible(&self) -> bool
[src]
Return true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))
pub fn set_visible(&self, v: bool)
[src]
Show or hide the control to the user
pub fn size(&self) -> (u32, u32)
[src]
Return the size of the button in the parent window
pub fn set_size(&self, x: u32, y: u32)
[src]
Set the size of the button in the parent window
pub fn position(&self) -> (i32, i32)
[src]
Return the position of the button in the parent window
pub fn set_position(&self, x: i32, y: i32)
[src]
Set the position of the button in the parent window
pub fn text(&self) -> String
[src]
Return the text displayed in the TextInput
pub fn set_text<'a>(&self, v: &'a str)
[src]
Set the text displayed in the TextInput
pub fn placeholder_text<'a>(&self, text_length: usize) -> String
[src]
Return the placeholder text displayed in the TextInput when it is empty and does not have focus. The string returned will be as long as the user specified, however it might be longer or shorter than the actual placeholder text.
pub fn set_placeholder_text<'a>(&self, v: Option<&'a str>)
[src]
Set the placeholder text displayed in the TextInput when it is empty and does not have focus
pub fn class_name(&self) -> &'static str
[src]
Winapi class name used during control creation
pub fn flags(&self) -> u32
[src]
Winapi base flags used during window creation
pub fn forced_flags(&self) -> u32
[src]
Winapi flags required by the control
Trait Implementations
impl Default for TextInput
[src]
impl Drop for TextInput
[src]
impl<'_> From<&'_ TextInput> for ControlHandle
[src]
impl PartialEq<ControlHandle> for TextInput
[src]
fn eq(&self, other: &ControlHandle) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<TextInput> for TextInput
[src]
impl PartialEq<TextInput> for ControlHandle
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TextInput
impl !Send for TextInput
impl !Sync for TextInput
impl Unpin for TextInput
impl UnwindSafe for TextInput
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>,