Table of Contents

Class TimeTextProvider

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

Time input provider for TextValidateField. Provides time editing with culture-aware formatting, supporting both 12-hour and 24-hour formats.

public class TimeTextProvider : ITextValidateProvider
Inheritance
TimeTextProvider
Implements
Inherited Members

Remarks

This provider parses the LongTimePattern to determine:

<ul><li>12-hour (h/hh) vs 24-hour (H/HH) format</li><li>Presence of AM/PM designator (tt)</li><li>Time separator character</li><li>Dynamic field width based on pattern</li></ul>

The cursor automatically skips over separator characters and AM/PM designators during navigation. For 12-hour formats, typing 'A' or 'P' on the AM/PM position toggles between AM and PM.

Constructors

TimeTextProvider()

Initializes a new instance of the TimeTextProvider class.

Properties

DisplayText

Gets the formatted string for display.

Fixed

Set that this provider uses a fixed width. e.g. Masked ones are fixed.

Format

Gets or sets the DateTimeFormatInfo used for time formatting.

IsValid

True if the input is valid, otherwise false.

Text

Set the input text and get the current value.

TimeValue

Gets or sets the current time value.

Methods

Cursor(int)

Set Cursor position to pos.

CursorEnd()

Find the last valid character position.

CursorLeft(int)

First valid position before pos.

CursorRight(int)

First valid position after pos.

CursorStart()

Find the first valid character position.

Delete(int)

Deletes the current character in pos.

InsertAt(char, int)

Insert character ch in position pos.

OnTextChanged(EventArgs<string>)

Called when the text has changed. Subclasses can override this to perform custom actions.

Events

TextChanged

Changed event, raised when the text has changed. This event is raised when the Text changes. The passed EventArgs is a string containing the old value.