Struct native_windows_gui::RichTextBox [−][src]
pub struct RichTextBox { 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
.
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.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:
OnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel eventMousePress(_)
: Generic mouse press events on the buttonOnKeyPress
: Generic key press eventOnKeyRelease
: Generic key release eventOnChar
: Generic key event. Returns achar
instead of a virtual key code
Fields
handle: ControlHandle
Implementations
Sets the background color for a rich edit control. You cannot get the background color of a rich text box
Sets the character format of the currently selected text
Returns the character format of the current selected text
Sets the paragraph formatting for the current selection in a rich edit control
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
Set the font of the control
It is not possible to get the base font handle of a rich label. Use char_format
instead.
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 control.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
Winapi class name used during control creation
Winapi flags required by the control
Trait Implementations
Returns the “default value” for a 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 !=
.
Auto Trait Implementations
impl RefUnwindSafe for RichTextBox
impl !Send for RichTextBox
impl !Sync for RichTextBox
impl Unpin for RichTextBox
impl UnwindSafe for RichTextBox