Table of Contents

Method NewKeyDownEvent

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

NewKeyDownEvent(Key)

If the view is enabled, raises the related key down events on the view, and returns true if the event was handled.

public bool NewKeyDownEvent(Key key)

Parameters

key Key

Returns

bool

true if the event was handled.

Remarks

If the view has a sub view that is focused, NewKeyDownEvent(Key) will be called on the focused view first.

If a more focused subview does not handle the key press, this method raises OnKeyDown(Key)/ KeyDown to allow the view to pre-process the key press. If OnKeyDown(Key)/KeyDown is not handled any commands bound to the key will be invoked. Then, only if no key bindings are handled, OnKeyDownNotHandled(Key)/KeyDownNotHandled will be raised allowing the view to process the key press.

Calling this method for a key bound to the view via an Application-scoped keybinding will have no effect. Instead, use RaiseKeyDownEvent(Key).

See for an overview of Terminal.Gui keyboard APIs.