TextArea class Core

A text input of several lines: the text wraps at the field's width, Enter starts a new line, and the field scrolls inside itself when the text is taller than it (wheel, or the caret leaving the view). Caret, selection, word and line keys, undo, the clipboard and the input method's anchor work as in a TextBox; Up and Down keep the column the caret came from, Home and End go to the start and end of the line as shown, Ctrl+Home and Ctrl+End to the start and end of the text.

Virtualized: only the lines in view are drawn. A key repaints only the lines it changed and the caret's old and new place - typing a letter redraws one line, not the field. The wrap is kept per paragraph and only the paragraph that changed is wrapped again; inside a long paragraph, only the lines from the one before the edit until a break lands on an old one.

A new text, width or text style wraps only the paragraphs in view and a page around them at once; the rest stands in with an estimated height and is wrapped a slice per frame (Control.Tick), the text in view staying where it is while the scroll bar settles on the exact height. A new width keeps the text at the top of the view, not the scroll offset. Limit: a paragraph is wrapped whole, so one paragraph of 100,000 characters costs as before.

Styling. As a text box (Select.Type<TextArea>()): background, border colour and width, corner radius, the accent colour (the caret and the focused border), the text's colour, size and family, in the states hover, focus and disabled.

Set TextArea.Text on a shown board inside Board.Mutate.

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

Constructors

TextArea

public TextArea();

A field with no text.

Properties

AccessibleValue

public override string? AccessibleValue { get; }

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

Buffer

public TextEditBuffer Buffer { get; }

The edit buffer: text, caret and selection, the model every text field shares. A change made to it from outside (on the UI thread; on a shown board inside Board.Mutate) lays the field out and repaints it as typing does.

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, an edit key or a paste.

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.

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.

Focusable

public override bool Focusable { get; }

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

LineCount

public int LineCount { get; }

How many lines the text takes at the field's width, wrapped lines counted. For the few frames after a long new text or a new width in which the text beyond the view is still being wrapped, an estimate.

Placeholder

public LocalText Placeholder { get; init; }

Shown dimmed while the field is empty.

ReadOnly

public bool ReadOnly { get; set; }

The text can be read, selected and copied, but not changed by the user: typing, Enter, the editing keys, cut, paste and undo do nothing, and the edit menu offers only Copy and Select all. TextArea.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.

ScrollOffset

public double ScrollOffset { get; }

How far the text is scrolled up inside the field.

Spoken

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

What a screen reader calls the field.

Text

public string Text { get; set; }

The text, lines separated by a line feed. Setting it puts the caret at the end and repaints; it does not raise TextArea.Changed, which reports typing. The text the field already holds changes nothing: caret, selection and undo stay.

VisibleLines

public int VisibleLines { get; init; }

How many lines the field shows without scrolling; its desired height.

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.

WantsTick

public override bool WantsTick { get; }

The control animates and wants Control.Tick on every frame.

Methods

Arrange

public override void Arrange(LogRect bounds);

CursorAt

public override GridCursor CursorAt(LogPoint p);

The I-beam over the text, the arrow over the scroll bar's strip while the text scrolls.

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);

OnWheel

public override bool OnWheel(LogPoint p, double delta);

Paste

public void Paste(string text);

Clipboard text typed in at the caret, its line breaks kept.

Render

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

SetAccessibleValue

public override bool SetAccessibleValue(string value);

Exactly the typed path (buffer, TextArea.Changed, repaint): UIA's SetValue edits.

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.

Tick

public override void Tick(double dtMs);

Wraps a slice of the text beyond the view; the view keeps its text, the scroll bar settles on the exact height.