[][src]Struct native_windows_gui::RichTextBox

pub struct RichTextBox {
    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.

A rich text box is almost a superset of the normal textbox. Unlike text box, rich text box has more features and can support Component Object Model (COM) objects.

The rich text box control supports the following rich text features:

  • Colored text
  • Multiple fonts
  • Styled text such as bold, underscore, strikeout, etc
  • Bullet point list
  • Paragraph with custom indent/offset
  • Custom line spacing

See: https://docs.microsoft.com/en-us/windows/win32/controls/about-rich-edit-controls#rich-edit-version-41

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:

  • OnMouseMove: Generic mouse mouse event
  • OnMouseWheel: Generic mouse wheel event
  • MousePress(_): Generic mouse press events on the button
  • OnKeyPress: Generic key press event
  • OnKeyRelease: Generic key release event
  • OnChar: Generic key event. Returns a char instead of a virtual key code

Fields

handle: ControlHandle

Implementations

impl RichTextBox[src]

pub fn builder<'a>() -> RichTextBoxBuilder<'a>[src]

pub fn set_background_color(&self, color: [u8; 3])[src]

Sets the background color for a rich edit control. You cannot get the background color of a rich text box

pub fn set_char_format(&self, fmt: &CharFormat)[src]

Sets the character format of the currently selected text

pub fn char_format(&self) -> CharFormat[src]

Returns the character format of the current selected text

pub fn set_para_format(&self, fmt: &ParaFormat)[src]

Sets the paragraph formatting for the current selection in a rich edit control

pub fn para_format(&self) -> ParaFormat[src]

Returns the paragraph formatting for the current selection in a rich edit control If more than one paragraph is selected, receive the attributes of the first paragraph

pub fn set_font(&self, font: Option<&Font>)[src]

Set the font of the control It is not possible to get the base font handle of a rich label. Use char_format instead.

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 control.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 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 RichTextBox[src]

impl Drop for RichTextBox[src]

impl Eq for RichTextBox[src]

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

impl PartialEq<ControlHandle> for RichTextBox[src]

impl PartialEq<RichTextBox> for RichTextBox[src]

impl PartialEq<RichTextBox> for ControlHandle[src]

impl StructuralEq for RichTextBox[src]

impl StructuralPartialEq for RichTextBox[src]

Auto Trait Implementations

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.