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. Unlike flags, ex_flags must be used straight from winapi
  • font: The font used for the text box text
  • limit: The maximum number of character that can be inserted in the control
  • readonly: If the textbox should allow user input or not
  • focus: The control receive focus after being created

Control events:

  • OnTextInput: When a TextBox value is changed
  • MousePress(_): Generic mouse press events on the button
  • OnMouseMove: Generic mouse mouse event
  • OnMouseWheel: Generic mouse wheel event
  • OnKeyPress: Generic key press event
  • OnKeyRelease: 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

Return the font of the control

Set the font of the control

Return the number of maximum character allowed in this text input

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

Undo the last action by the user in the control

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)

Remove all text from the textbox

Return true if the control currently has the keyboard focus

Set the keyboard focus on the button

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

Return the size of the button in the parent window

Set the size of the button in the parent window

Return the position of the button in the parent window

Set the position of the button in the parent window

Return the text displayed in the TextInput

Set the text displayed in the TextInput

Winapi class name used during control creation

Winapi base flags used during window creation

Winapi flags required by the control

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.