Class TextBox
- Namespace
- RichHudFramework.UI
- Assembly
- RichHudClient.dll
Interactive, clickable text box with caret and highlighting. Text only, no background or scrollbars.
public class TextBox : Label, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IMinLabelElement, IClickableElement, IBindInputElement, IFocusableElement, IValueControl<ITextBuilder>, IValueControl
- Inheritance
-
TextBox
- Implements
- Inherited Members
Constructors
TextBox()
public TextBox()
TextBox(HudParentBase)
public TextBox(HudParentBase parent)
Parameters
parentHudParentBase
Properties
BindInput
Custom bind input interface for this element. Handles input events for cut, copy, paste, etc.
public IBindInput BindInput { get; }
Property Value
CaretPosition
Index of the character currently selected by the caret.
public Vector2I CaretPosition { get; }
Property Value
CharFilterFunc
Used to restrict the range of characters allowed for input.
public Func<char, bool> CharFilterFunc { get; set; }
Property Value
ClearSelectionOnLoseFocus
If true, any text selections will be cleared when focus is lost.
public bool ClearSelectionOnLoseFocus { get; set; }
Property Value
EnableEditing
Determines whether or not the textbox will allow the user to edit its contents
public bool EnableEditing { get; set; }
Property Value
EnableHighlighting
Determines whether the user will be allowed to highlight text
public bool EnableHighlighting { get; set; }
Property Value
FocusHandler
Interface used to manage the element's input focus state
public IFocusHandler FocusHandler { get; }
Property Value
InputOpen
Indicates whether or not the textbox will accept input
public bool InputOpen { get; }
Property Value
IsMousedOver
Indicates whether or not the element is capturing the cursor.
public override bool IsMousedOver { get; }
Property Value
MouseInput
Mouse input interface for this clickable element
public IMouseInput MouseInput { get; }
Property Value
MoveToEndOnGainFocus
If true, the caret will move to the end of the text when it gains focus.
public bool MoveToEndOnGainFocus { get; set; }
Property Value
NewLineChar
Alternative line break character. Useful if Enter/Return is unavailable.
public char NewLineChar { get; set; }
Property Value
SelectionEmpty
If true, then text box currently has a range of characters selected.
public bool SelectionEmpty { get; }
Property Value
SelectionEnd
Index of the last character in the selected range.
public Vector2I SelectionEnd { get; }
Property Value
SelectionStart
Index of the first character in the selected range.
public Vector2I SelectionStart { get; }
Property Value
UpdateValueCallback
Registers a text update callback. For use in object initializers.
public EventHandler UpdateValueCallback { set; }
Property Value
Value
Returns an interface to the rich text content of the control.
Supports object.ToString() for getting plain text copies.
public ITextBuilder Value { get; }
Property Value
Methods
ClearSelection()
Clears selected text range.
public void ClearSelection()
ClearSelection(object, EventArgs)
Handles clearing selection on left click or escape
protected virtual void ClearSelection(object sender, EventArgs args)
Parameters
CloseInput()
Closes textbox input and clears the text selection.
public void CloseInput()
CopyText(object, EventArgs)
Copies the currently selected text to the clipboard if input is allowed and highlighting is enabled.
protected virtual void CopyText(object sender, EventArgs args)
Parameters
CutText(object, EventArgs)
Cuts the currently selected text to the clipboard if input is allowed, editing is enabled, and highlighting is enabled. Deletes the selection and adjusts the caret position accordingly.
protected virtual void CutText(object sender, EventArgs args)
Parameters
GainFocus(object, EventArgs)
Handles gaining input focus. Moves caret to end if configured to do so.
protected virtual void GainFocus(object sender, EventArgs args)
Parameters
HandleTextChange()
Marks a text change as pending invocation of the TextChanged event.
protected virtual void HandleTextChange()
LoseFocus(object, EventArgs)
Handles losing input focus. Clears selection if configured to do so.
protected virtual void LoseFocus(object sender, EventArgs args)
Parameters
OpenInput()
Opens the textbox for input and moves the caret to the end.
public void OpenInput()
PasteText(object, EventArgs)
Pastes the clipboard text at the caret position if input is allowed and editing is enabled. Replaces any existing selection and adjusts the caret position.
protected virtual void PasteText(object sender, EventArgs args)
Parameters
SelectAllText(object, EventArgs)
Selects all text in the textbox if input is allowed and highlighting is enabled. Moves the caret to the end and sets the full text range as the selection.
protected virtual void SelectAllText(object sender, EventArgs args)
Parameters
SetSelection(Vector2I, Vector2I)
Highlights the range of text specified.
public void SetSelection(Vector2I start, Vector2I end)
Parameters
Events
ValueChanged
Invoked whenever a change is made to the text. Invokes once every 500ms, at most.
public event EventHandler ValueChanged