Table of Contents

Class TextField

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Single-line text entry View

public class TextField : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Inheritance
TextField
Implements
Derived
Inherited Members

Remarks

The TextFieldView provides editing functionality and mouse support.

Constructors

TextField()

Initializes a new instance of the TextField class using Computed positioning.

TextField(ustring)

Initializes a new instance of the TextField class using Computed positioning.

TextField(int, int, int, ustring)

Initializes a new instance of the TextField class using Absolute positioning.

TextField(string)

Initializes a new instance of the TextField class using Computed positioning.

Properties

Autocomplete

Provides autocomplete context menu based on suggestions at the current cursor position. Populate AllSuggestions to enable this feature.

CanFocus

Gets or sets a value indicating whether this Responder can focus.

ContextMenu

Get the ContextMenu for this view.

CursorPosition

Sets or gets the current cursor position.

DesiredCursorVisibility

Get / Set the wished cursor when the field is focused

Frame

Gets or sets the frame for the view. The frame is relative to the view's container (SuperView).

HasHistoryChanges

Indicates whatever the text has history changes or not. true if the text has history changes false otherwise.

IsDirty

Indicates whatever the text was changed or not. true if the text was changed false otherwise.

ReadOnly

If set to true its not allow any changes in the text.

ScrollOffset

Gets the left offset position.

Secret

Sets the secret property.

SelectedLength

Length of the selected text.

SelectedStart

Start position of the selected text.

SelectedText

The selected text.

Text

Sets or gets the text held by the view.

Used

Tracks whether the text field should be considered "used", that is, that the user has moved in the entry, so new input should be appended at the cursor position, rather than clearing the entry

Methods

ClearAllSelection()

Clear the selected text.

ClearHistoryChanges()

Allows clearing the HistoryText.HistoryTextItem items updating the original text.

Copy()

Copy the selected text to the clipboard.

Cut()

Cut the selected text to the clipboard.

DeleteAll()

Deletes all text.

DeleteCharLeft(bool)

Deletes the left character.

DeleteCharRight()

Deletes the right character.

GetNormalColor()

Determines the current ColorScheme based on the Enabled value.

InsertText(string, bool)

Inserts the given toAdd text at the current cursor position exactly as if the user had just typed it

KillWordBackwards()

Deletes word backwards.

KillWordForwards()

Deletes word forwards.

MouseEvent(MouseEvent)

Method invoked when a mouse event is generated

OnEnter(View)

Method invoked when a view gets focus.

OnLeave(View)

Method invoked when a view loses focus.

OnTextChanging(ustring)

Virtual method that invoke the TextChanging event if it's defined.

Paste()

Paste the selected text from the clipboard.

PositionCursor()

Sets the cursor position.

ProcessKey(KeyEvent)

Processes key presses for the TextField.

Redraw(Rect)

Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.

SelectAll()

Selects all text.

Events

TextChanged

Changed event, raised when the text has changed.

TextChanging

Changing event, raised before the Text changes and can be canceled or changing the new text.