Table of Contents

Method UngrabMouse

Namespace
Terminal.Gui.App
Assembly
Terminal.Gui.dll

UngrabMouse()

Releases the mouse grab, restoring normal mouse event routing to the view under the mouse pointer.

void UngrabMouse()

Remarks

Event Sequence: UnGrabbingMouse → (if not cancelled) → UnGrabbedMouse

Behavior:

  • If no view currently has the grab, this method does nothing.
  • If UnGrabbingMouse is cancelled, the grab remains active.
  • After ungrab, MouseEnter/MouseLeave events are updated for views under the mouse.

Typical Call Sites: In OnMouseEvent(Mouse) when handling LeftButtonReleased or click events to end a drag operation.

Auto-Ungrab: For views with MouseHighlightStates or MouseHoldRepeat enabled, ungrab is called automatically on click events. See NewMouseEvent(Mouse) for details.

See Also