TextBox class Core

A text input over the shared TextFieldWidget (buffer, caret, selection, caret-follow scroll). Inherent behaviours: a click places the caret (the router has already moved the focus here — that is ITS rule), dragging selects, double/triple click select word/all, typing inserts, and the field's accent border is the focus visual. The pane only wires the endpoints: TextBox.Changed, TextBox.Committed, TextBox.Cancelled.

Styling. From the style sheets (Select.Type<TextBox>()): background, border colour and width, corner radius (else the field's own TextFieldWidget.CornerRadius) and the accent colour (the caret), in the states hover, focus and disabled; a text box made with Controls.TextBox also takes the text colour and font. The theme's rules draw the card-coloured field whose border takes the accent while it holds the focus.

public sealed class TextBox : Control
Namespace
ArionUI.Presentation.Controls
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease
Inherits
Control

Constructors

TextBox

public TextBox();

A text box in the theme's cell font that measures its caret with the tree's measure (ControlHost.MeasureText) - what a form on a board wants.

TextBox

public TextBox(Func<TextStyle> style, Func<string, TextStyle, double> measure);

Properties

AccessibleValue

public override string? AccessibleValue { get; }

The text of a text part; null when the part carries no value.

Cancelled

public Action? Cancelled { get; init; }

Escape — usually the pane's close.

CaretRect

public override LogRect? CaretRect { get; }

Where the caret of a text sink stands, absolute like Control.Bounds and as last drawn; null for a control without a caret or before it was drawn. The host anchors the input method's candidate window here.

Changed

public Action? Changed { get; init; }

Text changed through typing or edit keys.

Committed

public Action? Committed { get; init; }

Enter — the pane decides what committing means (apply, search…).

Cursor

public override GridCursor Cursor { get; }

The pointer shape over this control: the arrow (GridCursor.Default) over buttons, options, tabs and everything else that is clicked, the I-beam (GridCursor.Text) over text that can be typed in, the hand only over a link - the Windows rule. A control with parts of different shapes answers Control.CursorAt.

DrawAdornment

public Action<IRenderSurface, LogRect>? DrawAdornment { get; init; }

Extra chrome inside the box (the search magnifier), drawn after the field.

DrawsOwnFocus

public override bool DrawsOwnFocus { get; }

The control shows its focus itself (accent border, hover row, ring parameter). False = the host draws the shared default ring around Control.Bounds.

Field

public TextFieldWidget Field { get; }

The shared field widget — exposed so behaviour stays testable through the same object every other text field uses, not through pixels.

Fill

public Rgba? Fill { get; init; }

Box fill — the search bar sits on RowEven, panes on CardFill (default). Weighs like a presentational hint: over the theme, under the application's sheets.

Focusable

public override bool Focusable { get; }

Can this KIND of control hold the keyboard focus? Combined with the live probes in Control.CanTakeFocus.

Height

public double Height { get; init; }

Desired height of one line of input; the width is whatever it is given.

ReadOnly

public bool ReadOnly { get; set; }

The text can be read, selected and copied, but not changed by the user: typing, the editing keys, cut, paste and undo do nothing, and the edit menu offers only Copy and Select all. TextBox.Text still sets it. A screen reader hears it as read-only. Change it on the UI thread (inside Board.Mutate on a shown board).

Role

public override ControlRole Role { get; }

What KIND of part this is for assistive technology — the automation peers translate it into their host's control type.

Spoken

public Func<string>? Spoken { get; init; }

Suffix

public Func<string>? Suffix { get; init; }

The unit after the value ("pcs", "kg"), drawn dim at the right inside the box; the text stops short of it, and the mark of an invalid value stands before it. Null for none.

Text

public string Text { get; set; }

The text in the box. Setting it loads the text: the caret goes to the end, the box repaints, and the undo history starts afresh - Ctrl+Z takes back typing, never the text the application put in. It does not raise TextBox.Changed, which reports typing. The text the box already holds changes nothing: caret, selection and undo stay, so a binding that writes the value back does not disturb the typing.

WantsText

public override bool WantsText { get; }

Is this control a text sink? The host routes typing to the focused text control, or — the Excel rule — jumps to the FIRST one in the tree.

Methods

Arrange

public override void Arrange(LogRect bounds);

CursorAt

public override GridCursor CursorAt(LogPoint p);

The I-beam over the text, the arrow over what the field keeps at its right edge (a search box's magnifier, the mark of an invalid value).

Measure

public override LogSize Measure(LogSize available);

Desired size given the space available (layout containers sum this).

OnAttached

protected internal override void OnAttached();

A host shows the tree this control is in: it joined a shown board, or the board's view was attached. UI thread, under the render gate; the render pass may be running on the UI thread, so ask for frames here (Control.RequestTick), not for a repaint.

OnKey

public override bool OnKey(ArionKey key, ArionModifiers mods);

Keys while focused. Return false to let the pane's fallback see the key.

OnPointerMoved

public override void OnPointerMoved(LogPoint p, bool buttonDown);

OnPointerPressed

public override void OnPointerPressed(LogPoint p, ArionModifiers mods, int clickCount);

OnPointerReleased

public override void OnPointerReleased(LogPoint p);

OnText

public override void OnText(string text);

Paste

public void Paste(string text);

Clipboard text typed in at the caret: one line, as the box holds one.

Render

public override void Render(IRenderSurface s, ControlFrame frame);

SetAccessibleValue

public override bool SetAccessibleValue(string value);

Exactly the typed path (buffer, TextBox.Changed, repaint) without a commit — UIA's SetValue edits, it does not press Enter. The horizontal scroll follows the caret on the next draw.

SpokenLabel

public override string? SpokenLabel();

What a screen reader speaks when this control receives the focus. A control that cannot take the focus but answers here is READ: it becomes a text part.