Struct native_windows_gui::TextBox [−][src]
pub struct TextBox { pub handle: ControlHandle, }
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 allow multi line input. For a single line of text, use TextInput
.
Requires the textbox
feature.
Note: Use \r\n
to input a new line not just \n
.
Builder parameters:
parent
: Required. The text box parent container.text
: The text box text.size
: The text box size.position
: The text box position.flags
: A combination of the TextBoxFlags 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 box textlimit
: The maximum number of character that can be inserted in the controlreadonly
: If the textbox should allow user input or notfocus
: The control receive focus after being created
Control events:
OnTextInput
: When a TextBox value is changedMousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel eventOnKeyPress
: Generic key press eventOnKeyRelease
: Generic key release event
use native_windows_gui as nwg; fn build_box(tbox: &mut nwg::TextBox, window: &nwg::Window, font: &nwg::Font) { nwg::TextBox::builder() .text("Hello") .font(Some(font)) .parent(window) .build(tbox); }
Fields
handle: ControlHandle
Implementations
Set the number of maximum character allowed in this text input
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 test.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
Winapi class name used during control creation
Winapi flags required by the control
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TextBox
impl UnwindSafe for TextBox