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; }
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.
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; }
Text
public string Text { get; set; }The text in the box. Setting it replaces the text, puts the caret at the end and repaints; it does not raise TextBox.Changed, which reports 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
Measure
public override LogSize Measure(LogSize available);Desired size given the space available (layout containers sum this).
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.
