Skip to content

TextBoxWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

csharp
public sealed record TextBoxWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<TextBoxWidget>

Inheritance

ObjectHex1bWidgetTextBoxWidget

Implements

Constructors

TextBoxWidget(string?)

Parameters:

csharp
public TextBoxWidget(string? Text = null)

Properties

MaxWidth

Maximum width of the text box in columns. When set, the text box will not exceed this width. Defaults to the same value as MinWidth if not explicitly set.

Returns: Nullable<Int32>

csharp
public int? MaxWidth { get; init; }

MinWidth

Minimum width of the text box in columns. When set, the text box will measure at least this many columns wide regardless of content.

Returns: Nullable<Int32>

csharp
public int? MinWidth { get; init; }

Text

Returns: String

csharp
public string? Text { get; init; }

Methods

Height(int)

Sets the height of the text box in lines.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget Height(int lines)

Multiline()

Enables multi-line text editing. Enter inserts newlines, Up/Down arrows navigate between lines, and word wrapping can be enabled.

Returns: TextBoxWidget

csharp
public TextBoxWidget Multiline()

Multiline(int)

Enables multi-line text editing with a maximum number of lines. Once the limit is reached, no more newlines can be inserted.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget Multiline(int maxLines)

OnPaste(Action<PasteEventArgs>)

Sets a synchronous handler called when paste data is received. Overrides the default behavior of inserting pasted text at the cursor position.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnPaste(Action<PasteEventArgs> handler)

OnPaste(Func<PasteEventArgs, Task>)

Sets an asynchronous handler called when paste data is received. Overrides the default behavior of inserting pasted text at the cursor position.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnPaste(Func<PasteEventArgs, Task> handler)

OnSubmit(Action<TextSubmittedEventArgs>)

Sets a synchronous handler called when Enter is pressed in the text box.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnSubmit(Action<TextSubmittedEventArgs> handler)

OnSubmit(Func<TextSubmittedEventArgs, Task>)

Sets an asynchronous handler called when Enter is pressed in the text box.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnSubmit(Func<TextSubmittedEventArgs, Task> handler)

OnTextChanged(Action<TextChangedEventArgs>)

Sets a synchronous handler called when the text content changes.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnTextChanged(Action<TextChangedEventArgs> handler)

OnTextChanged(Func<TextChangedEventArgs, Task>)

Sets an asynchronous handler called when the text content changes.

Parameters:

Returns: TextBoxWidget

csharp
public TextBoxWidget OnTextChanged(Func<TextChangedEventArgs, Task> handler)

WordWrap()

Enables word wrapping for multi-line text boxes. Long lines are visually broken at word boundaries to fit the available width.

Returns: TextBoxWidget

csharp
public TextBoxWidget WordWrap()

Fields

DeleteBackward

Rebindable action: Delete character backward.

Returns: ActionId

csharp
public static readonly ActionId DeleteBackward

DeleteForward

Rebindable action: Delete character forward.

Returns: ActionId

csharp
public static readonly ActionId DeleteForward

DeleteWordBackward

Rebindable action: Delete previous word.

Returns: ActionId

csharp
public static readonly ActionId DeleteWordBackward

DeleteWordForward

Rebindable action: Delete next word.

Returns: ActionId

csharp
public static readonly ActionId DeleteWordForward

InsertNewline

Rebindable action: Insert a newline (multiline only).

Returns: ActionId

csharp
public static readonly ActionId InsertNewline

InsertText

Rebindable action: Insert typed text.

Returns: ActionId

csharp
public static readonly ActionId InsertText

MoveDown

Rebindable action: Move cursor down one line (multiline only).

Returns: ActionId

csharp
public static readonly ActionId MoveDown

MoveEnd

Rebindable action: Move cursor to end.

Returns: ActionId

csharp
public static readonly ActionId MoveEnd

MoveHome

Rebindable action: Move cursor to start.

Returns: ActionId

csharp
public static readonly ActionId MoveHome

MoveLeft

Rebindable action: Move cursor left.

Returns: ActionId

csharp
public static readonly ActionId MoveLeft

MoveRight

Rebindable action: Move cursor right.

Returns: ActionId

csharp
public static readonly ActionId MoveRight

MoveUp

Rebindable action: Move cursor up one line (multiline only).

Returns: ActionId

csharp
public static readonly ActionId MoveUp

MoveWordLeft

Rebindable action: Move cursor to previous word.

Returns: ActionId

csharp
public static readonly ActionId MoveWordLeft

MoveWordRight

Rebindable action: Move cursor to next word.

Returns: ActionId

csharp
public static readonly ActionId MoveWordRight

SelectAll

Rebindable action: Select all text.

Returns: ActionId

csharp
public static readonly ActionId SelectAll

SelectDown

Rebindable action: Extend selection down one line (multiline only).

Returns: ActionId

csharp
public static readonly ActionId SelectDown

SelectLeft

Rebindable action: Extend selection left.

Returns: ActionId

csharp
public static readonly ActionId SelectLeft

SelectRight

Rebindable action: Extend selection right.

Returns: ActionId

csharp
public static readonly ActionId SelectRight

SelectToEnd

Rebindable action: Select to end.

Returns: ActionId

csharp
public static readonly ActionId SelectToEnd

SelectToStart

Rebindable action: Select to start.

Returns: ActionId

csharp
public static readonly ActionId SelectToStart

SelectUp

Rebindable action: Extend selection up one line (multiline only).

Returns: ActionId

csharp
public static readonly ActionId SelectUp

SelectWordLeft

Rebindable action: Extend selection to previous word.

Returns: ActionId

csharp
public static readonly ActionId SelectWordLeft

SelectWordRight

Rebindable action: Extend selection to next word.

Returns: ActionId

csharp
public static readonly ActionId SelectWordRight

Submit

Rebindable action: Submit text.

Returns: ActionId

csharp
public static readonly ActionId Submit

Released under the MIT License.