Struct native_windows_gui::TextInput [−][src]
pub struct TextInput { pub handle: ControlHandle, // some fields omitted }
Expand description
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.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapifont
: 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
Return the password character displayed by the text input. If the input is not a password, return None.
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
Set the number of maximum character allowed in this text input
If limit
is 0, the text length is set to 0x7FFFFFFE characters
Check if the content of the text input was modified after it’s creation
Manually set modified flag of the text input
Return the selected range of characters by the user in the text input
Return the selected range of characters by the user in the text input
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
Return true if the TextInput value cannot be edited. Retrurn false otherwise. A user can still copy text from a readonly TextEdit (unlike disabled)
Set the readonly flag of the text input A user can still copy text from a readonly TextEdit (unlike disabled)
Return true if the control user can interact with the control, return false otherwise
Enable or disable the control
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))
Show or hide the control to the user
Set the position of the button in the parent window
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.
Set the placeholder text displayed in the TextInput when it is empty and does not have focus
Winapi class name used during control creation
Winapi flags required by the control
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for TextInput
impl UnwindSafe for TextInput