Class TextField
Single-line text entry View
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class TextField : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Remarks
Constructors
TextField()
Declaration
public TextField()
TextField(ustring)
Declaration
public TextField(ustring text)
Parameters
Type | Name | Description |
---|---|---|
NStack.ustring | text | Initial text contents. |
TextField(Int32, Int32, Int32, ustring)
Declaration
public TextField(int x, int y, int w, ustring text)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The x coordinate. |
System.Int32 | y | The y coordinate. |
System.Int32 | w | The width. |
NStack.ustring | text | Initial text contents. |
TextField(String)
Declaration
public TextField(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Initial text contents. |
Properties
CanFocus
Declaration
public override bool CanFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
CursorPosition
Sets or gets the current cursor position.
Declaration
public int CursorPosition { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DesiredCursorVisibility
Get / Set the wished cursor when the field is focused
Declaration
public CursorVisibility DesiredCursorVisibility { get; set; }
Property Value
Type | Description |
---|---|
CursorVisibility |
Frame
Declaration
public override Rect Frame { get; set; }
Property Value
Type | Description |
---|---|
Rect |
Overrides
ReadOnly
If set to true its not allow any changes in the text.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Secret
Sets the secret property.
Declaration
public bool Secret { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This makes the text entry suitable for entering passwords.
SelectedLength
Length of the selected text.
Declaration
public int SelectedLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectedStart
Start position of the selected text.
Declaration
public int SelectedStart { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectedText
The selected text.
Declaration
public ustring SelectedText { get; set; }
Property Value
Type | Description |
---|---|
NStack.ustring |
Text
Sets or gets the text held by the view.
Declaration
public ustring Text { get; set; }
Property Value
Type | Description |
---|---|
NStack.ustring |
Remarks
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
Declaration
public bool Used { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
ClearAllSelection()
Clear the selected text.
Declaration
public void ClearAllSelection()
Copy()
Copy the selected text to the clipboard.
Declaration
public virtual void Copy()
Cut()
Cut the selected text to the clipboard.
Declaration
public virtual void Cut()
MouseEvent(MouseEvent)
Declaration
public override bool MouseEvent(MouseEvent ev)
Parameters
Type | Name | Description |
---|---|---|
MouseEvent | ev |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OnEnter(View)
Declaration
public override bool OnEnter(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OnLeave(View)
Declaration
public override bool OnLeave(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OnTextChanging(ustring)
Virtual method that invoke the TextChanging event if it's defined.
Declaration
public virtual TextChangingEventArgs OnTextChanging(ustring newText)
Parameters
Type | Name | Description |
---|---|---|
NStack.ustring | newText | The new text to be replaced. |
Returns
Type | Description |
---|---|
TextChangingEventArgs | Returns the TextChangingEventArgs |
Paste()
Paste the selected text from the clipboard.
Declaration
public virtual void Paste()
PositionCursor()
Sets the cursor position.
Declaration
public override void PositionCursor()
Overrides
ProcessKey(KeyEvent)
Processes key presses for the TextField.
Declaration
public override bool ProcessKey(KeyEvent kb)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | kb |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
The TextField control responds to the following keys:
Keys | Function |
---|---|
Delete, Backspace | Deletes the character before cursor. |
Redraw(Rect)
Declaration
public override void Redraw(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Rect | bounds |
Overrides
Events
TextChanged
Changed event, raised when the text has changed.
Declaration
public event Action<ustring> TextChanged
Event Type
Type | Description |
---|---|
System.Action<NStack.ustring> |
Remarks
This event is raised when the Text changes.
TextChanging
Changing event, raised before the Text changes and can be canceled or changing the new text.
Declaration
public event Action<TextChangingEventArgs> TextChanging
Event Type
Type | Description |
---|---|
System.Action<TextChangingEventArgs> |
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize