[][src]Struct native_windows_gui::TextBox

pub struct TextBox {
    pub handle: ControlHandle,
}

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.
  • 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

impl TextBox[src]

pub fn builder<'a>() -> TextBoxBuilder<'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 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

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 test.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 clear(&self)[src]

Remove all text from the textbox

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 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 TextBox[src]

impl Drop for TextBox[src]

impl Eq for TextBox[src]

impl<'_> From<&'_ TextBox> for ControlHandle[src]

impl PartialEq<ControlHandle> for TextBox[src]

impl PartialEq<TextBox> for TextBox[src]

impl PartialEq<TextBox> for ControlHandle[src]

impl StructuralEq for TextBox[src]

impl StructuralPartialEq for TextBox[src]

Auto Trait Implementations

impl RefUnwindSafe for TextBox

impl !Send for TextBox

impl !Sync for TextBox

impl Unpin for TextBox

impl UnwindSafe for TextBox

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.