Table of Contents

Property Cursor

Namespace
Terminal.Gui.ViewBase
Assembly
Terminal.Gui.dll

Cursor

Gets or sets the cursor for this view. Position must be in screen coordinates.

public Cursor Cursor { get; set; }

Property Value

Cursor

Remarks

Use ViewportToScreen() to convert from view-relative coordinates.

To hide the cursor, set Position to null or set the Style property to Hidden.

Common patterns:

// Text cursor at column 5 in viewport - convert to screen coords
    Point screenPos = ViewportToScreen(new Point(5, 0));
    SetCursor(new Cursor { Position = screenPos, Shape = CursorStyle.BlinkingBar });
// Hide cursor
SetCursor(new Cursor { Position = null });
SetCursor(new Cursor { Style = CursorStyle.Hidden });

// Update position keeping same shape
Point newScreenPos = ViewportToScreen(new Point(6, 0));
SetCursor(_cursor with { Position = newScreenPos });</code></pre>