Class TextView
Multi-line text editing 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 TextView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Remarks
TextView provides a multi-line text editor. Users interact with it with the standard Emacs commands for movement or the arrow keys.
Shortcut | Action performed |
---|---|
Left cursor, Control-b | Moves the editing point left. |
Right cursor, Control-f | Moves the editing point right. |
Alt-b | Moves one word back. |
Alt-f | Moves one word forward. |
Up cursor, Control-p | Moves the editing point one line up. |
Down cursor, Control-n | Moves the editing point one line down |
Home key, Control-a | Moves the cursor to the beginning of the line. |
End key, Control-e | Moves the cursor to the end of the line. |
Control-Home | Scrolls to the first line and moves the cursor there. |
Control-End | Scrolls to the last line and moves the cursor there. |
Delete, Control-d | Deletes the character in front of the cursor. |
Backspace | Deletes the character behind the cursor. |
Control-k | Deletes the text until the end of the line and replaces the kill buffer with the deleted text. You can paste this text in a different place by using Control-y. |
Control-y | Pastes the content of the kill ring into the current position. |
Alt-d | Deletes the word above the cursor and adds it to the kill ring. You can paste the contents of the kill ring with Control-y. |
Control-q | Quotes the next input character, to prevent the normal processing of key handling to take place. |
Constructors
TextView()
Initializes a TextView on the specified area,
with dimensions controlled with the X, Y, Width and Height properties.
Declaration
public TextView()
TextView(Rect)
Initializes a TextView on the specified area, with absolute position and size.
Declaration
public TextView(Rect frame)
Parameters
Type | Name | Description |
---|---|---|
Rect | frame |
Remarks
Properties
CanFocus
Declaration
public override bool CanFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
CurrentColumn
Gets the cursor column.
Declaration
public int CurrentColumn { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The cursor column. |
CurrentRow
Gets the current cursor row.
Declaration
public int CurrentRow { get; }
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
LeftColumn
Gets or sets the left column.
Declaration
public int LeftColumn { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Lines
Gets the number of lines.
Declaration
public int Lines { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Maxlength
Gets the maximum visible length line.
Declaration
public int Maxlength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ReadOnly
Gets or sets whether the TextView is in read-only mode or not
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Boolean value(Default false) |
Text
Sets or gets the text in the TextView.
Declaration
public override ustring Text { get; set; }
Property Value
Type | Description |
---|---|
NStack.ustring |
Overrides
Remarks
TopRow
Gets or sets the top row.
Declaration
public int TopRow { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
CloseFile()
Closes the contents of the stream into the TextView.
Declaration
public bool CloseFile()
Returns
Type | Description |
---|---|
System.Boolean | true , if stream was closed, false otherwise. |
LoadFile(String)
Loads the contents of the file into the TextView.
Declaration
public bool LoadFile(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to the file to load. |
Returns
Type | Description |
---|---|
System.Boolean | true , if file was loaded, false otherwise. |
LoadStream(Stream)
Loads the contents of the stream into the TextView.
Declaration
public void LoadStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to load the contents from. |
MouseEvent(MouseEvent)
Declaration
public override bool MouseEvent(MouseEvent ev)
Parameters
Type | Name | Description |
---|---|---|
MouseEvent | ev |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
MoveEnd()
Will scroll the TextView to the last line and position the cursor there.
Declaration
public void MoveEnd()
MoveHome()
Will scroll the TextView to the first line and position the cursor there.
Declaration
public void MoveHome()
OnEnter(View)
Declaration
public override bool OnEnter(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
PositionCursor()
Positions the cursor on the current row and column
Declaration
public override void PositionCursor()
Overrides
ProcessKey(KeyEvent)
Declaration
public override bool ProcessKey(KeyEvent kb)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | kb |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Redraw(Rect)
Declaration
public override void Redraw(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Rect | bounds |
Overrides
ScrollTo(Int32, Boolean)
Will scroll the TextView to display the specified row at the top if
isRow
is true or
will scroll the TextView to display the specified column at the left if isRow
is false.
Declaration
public void ScrollTo(int idx, bool isRow = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | idx | Row that should be displayed at the top or Column that should be displayed at the left, if the value is negative it will be reset to zero |
System.Boolean | isRow | If true (default) the idx is a row, column otherwise. |
Events
TextChanged
Declaration
public event Action TextChanged
Event Type
Type | Description |
---|---|
System.Action |
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize