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
textstringThe markup text to display.
namestringOptional element name. Defaults to "statustext".
Properties
ClickHandler
Gets or sets an optional click handler.
public Action? ClickHandler { get; set; }
Property Value
Text
Gets or sets the markup text to display. Setting triggers a redraw.
public string Text { get; set; }
Property Value
TextColor
Gets or sets an optional text color override.
public Color? TextColor { get; set; }
Property Value
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
argsMouseEventArgsThe mouse event arguments.
elementXintThe x position of this element on screen.
elementWidthintThe 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)