Table of Contents

Method AddKeyBindingsForHotKey

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

AddKeyBindingsForHotKey(Key, Key, object?)

Adds key bindings for the specified HotKey. Useful for views that contain multiple items that each have their own HotKey such as OptionSelector.

public bool AddKeyBindingsForHotKey(Key prevHotKey, Key hotKey, object? data = null)

Parameters

prevHotKey Key

The HotKey hotKey is replacing. Key bindings for this key will be removed.

hotKey Key

The new HotKey. If Empty prevHotKey bindings will be removed.

data object

Arbitrary data that can be associated with this key binding.

Returns

bool

true if the HotKey bindings were added.

Remarks

Key bindings are added for both the base key (e.g. D3) and the Alt-shifted key (e.g. Key.D3.WithAlt).

When hotKey is A through Z key bindings will be added for both the un-shifted and shifted versions. This means if the HotKey is A, key bindings for Key.A and Key.A.WithShift will be added.

Exceptions

ArgumentException