Table of Contents

Class StatusTextElement

Namespace
SharpConsoleUI.Panel
Assembly
SharpConsoleUI.dll

A panel element that displays markup text. Text can be updated at runtime.

public class StatusTextElement : PanelElement, IPanelElement
Inheritance
StatusTextElement
Implements
Inherited Members
Extension Methods

Constructors

StatusTextElement(string, string?)

Initializes a new StatusTextElement with the given text.

public StatusTextElement(string text, string? name = null)

Parameters

text string

The markup text to display.

name string

Optional element name. Defaults to "statustext".

Properties

ClickHandler

Gets or sets an optional click handler.

public Action? ClickHandler { get; set; }

Property Value

Action

Text

Gets or sets the markup text to display. Setting triggers a redraw.

public string Text { get; set; }

Property Value

string

TextColor

Gets or sets an optional text color override.

public Color? TextColor { get; set; }

Property Value

Color?

Methods

MeasureWidth()

Measures the natural content width of this element. Used when FixedWidth is null and FlexGrow is 0.

public override int MeasureWidth()

Returns

int

The measured width in columns.

ProcessMouseEvent(MouseEventArgs, int, int)

Processes a mouse event that occurred within this element's bounds.

public override bool ProcessMouseEvent(MouseEventArgs args, int elementX, int elementWidth)

Parameters

args MouseEventArgs

The mouse event arguments.

elementX int

The x position of this element on screen.

elementWidth int

The allocated width of this element.

Returns

bool

True if the event was handled.

Render(CharacterBuffer, int, int, int, Color, Color)

Renders the element into the character buffer at the specified position.

public override void Render(CharacterBuffer buffer, int x, int y, int width, Color fg, Color bg)

Parameters

buffer CharacterBuffer

The character buffer to render into.

x int

The x position to render at.

y int

The y position to render at.

width int

The allocated width for this element.

fg Color

The default foreground color.

bg Color

The default background color.