Table of Contents

Class TextField

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Unlined clickable textbox with a background and border designed to look like text fields in the SE terminal.

public class TextField : LabelBoxBase, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IClickableElement, IBindInputElement, IFocusableElement, ILabelElement, IMinLabelElement, IValueControl<ITextBuilder>, IValueControl
Inheritance
TextField
Implements
Inherited Members

Constructors

TextField()

public TextField()

TextField(HudParentBase)

public TextField(HudParentBase parent)

Parameters

parent HudParentBase

Fields

border

Border around the text field

protected readonly BorderBox border

Field Value

BorderBox

lastColor

Last color set before highlighting/taking focus

protected Color lastColor

Field Value

Color

lastTextColor

Last text color set before highlighting/taking focus

protected Color lastTextColor

Field Value

Color

textBox

Interactable text element backing the field

protected readonly TextBox textBox

Field Value

TextBox

Properties

AutoResize

If true, the element will automatically resize to fit the text.

public override bool AutoResize { get; set; }

Property Value

bool

BindInput

Custom bind input interface for this element

public IBindInput BindInput { get; }

Property Value

IBindInput

BorderColor

Color of the thin border surrounding the text field

public Color BorderColor { get; set; }

Property Value

Color

BorderThickness

Thickness of the border around the text field

public float BorderThickness { get; set; }

Property Value

float

BuilderMode

Line formatting mode used by the field

public TextBuilderModes BuilderMode { get; set; }

Property Value

TextBuilderModes

CharFilterFunc

Used to restrict the range of characters allowed for input.

public Func<char, bool> CharFilterFunc { get; set; }

Property Value

Func<char, bool>

EnableEditing

Determines whether or not the textbox will allow the user to edit its contents

public bool EnableEditing { get; set; }

Property Value

bool

EnableTextHighlighting

Determines whether the user will be allowed to highlight text

public bool EnableTextHighlighting { get; set; }

Property Value

bool

FocusColor

Background color when the text field has input focus

public Color FocusColor { get; set; }

Property Value

Color

FocusHandler

Interface used to manage the element's input focus state

public IFocusHandler FocusHandler { get; }

Property Value

IFocusHandler

FocusTextColor

Text formatting used when the control gains focus.

public Color FocusTextColor { get; set; }

Property Value

Color

Format

Default formatting used by the text field.

public GlyphFormat Format { get; set; }

Property Value

GlyphFormat

HighlightColor

Background color when the text field is moused over

public Color HighlightColor { get; set; }

Property Value

Color

HighlightEnabled

If true then the text field will change color when moused over

public bool HighlightEnabled { get; set; }

Property Value

bool

InputOpen

Indicates whether or not the text field will accept input

public bool InputOpen { get; }

Property Value

bool

IsMousedOver

Indicates whether or not the element is capturing the cursor.

public override bool IsMousedOver { get; }

Property Value

bool

MouseInput

Mouse input interface for this clickable element

public IMouseInput MouseInput { get; }

Property Value

IMouseInput

SelectionEmpty

If true, then text box currently has a range of characters selected.

public bool SelectionEmpty { get; }

Property Value

bool

SelectionEnd

Index of the last character in the selected range.

public Vector2I SelectionEnd { get; }

Property Value

Vector2I

SelectionStart

Index of the first character in the selected range.

public Vector2I SelectionStart { get; }

Property Value

Vector2I

Text

Text rendered by the text field.

public RichText Text { get; set; }

Property Value

RichText

TextBoard

TextBoard backing the text field.

public ITextBoard TextBoard { get; }

Property Value

ITextBoard

TextPadding

Padding around text element

public override Vector2 TextPadding { get; set; }

Property Value

Vector2

TextSize

Size of the text as rendered

public override Vector2 TextSize { get; set; }

Property Value

Vector2

UpdateValueCallback

Registers a text update callback. For use in object initializers.

public EventHandler UpdateValueCallback { set; }

Property Value

EventHandler

UseFocusFormatting

If true, then the text field will change formatting when it takes focus.

public bool UseFocusFormatting { get; set; }

Property Value

bool

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

ITextBuilder

VertCenterText

If true, the text will be vertically centered.

public bool VertCenterText { get; set; }

Property Value

bool

Methods

CloseInput()

Closes field input and clears the text selection.

public void CloseInput()

CursorEnter(object, EventArgs)

Sets highlighting formatting when the field is moused over

protected virtual void CursorEnter(object sender, EventArgs args)

Parameters

sender object
args EventArgs

CursorExit(object, EventArgs)

Clears highlighting when the cursor leaves

protected virtual void CursorExit(object sender, EventArgs args)

Parameters

sender object
args EventArgs

GainFocus(object, EventArgs)

Sets focus formatting

protected virtual void GainFocus(object sender, EventArgs args)

Parameters

sender object
args EventArgs

LoseFocus(object, EventArgs)

Resets focus formatting

protected virtual void LoseFocus(object sender, EventArgs args)

Parameters

sender object
args EventArgs

OpenInput()

Opens the field for input and moves the caret to the end.

public void OpenInput()

Events

ValueChanged

Invoked whenever a change is made to the text. Invokes once every 500ms, at most.

public event EventHandler ValueChanged

Event Type

EventHandler