Class ClockElement
- Namespace
- SharpConsoleUI.Panel
- Assembly
- SharpConsoleUI.dll
A panel element that displays the current time, auto-updating via a timer.
public class ClockElement : PanelElement, IPanelElement, IDisposable
- Inheritance
-
ClockElement
- Implements
- Inherited Members
- Extension Methods
Constructors
ClockElement(string?)
Initializes a new ClockElement.
public ClockElement(string? name = null)
Parameters
namestringOptional element name. Defaults to "clock".
Properties
FixedWidth
Gets the fixed width of this element, or null if it uses MeasureWidth() or flex sizing.
public override int? FixedWidth { get; }
Property Value
- int?
Format
Gets or sets the time format string (e.g., "HH:mm", "HH:mm:ss").
public string Format { get; set; }
Property Value
TextColor
Gets or sets an optional text color override.
public Color? TextColor { get; set; }
Property Value
UpdateIntervalMs
Gets or sets the update interval in milliseconds.
public int UpdateIntervalMs { get; set; }
Property Value
Methods
Dispose()
Disposes the timer resource.
public void Dispose()
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.
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)