Table of Contents

Method AddKeyBindingsForHotKey

Namespace
Terminal.Gui
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 RadioGroup.

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

Parameters

prevHotKey Key

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

hotKey Key

The new HotKey. If EmptyprevHotKey bindings will be removed.

context object

Arbitrary context that can be associated with this key binding.

Returns

bool

true if the HotKey bindings were added.

Remarks

By default, key bindings are added for both the base key (e.g. D3) and the Alt-shifted key (e.g. Key.D3.WithAlt) This behavior can be overriden by overriding AddKeyBindingsForHotKey(Key, Key, object?) .

By default, 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. This behavior can be overriden by overriding AddKeyBindingsForHotKey(Key, Key, object?).

Exceptions

ArgumentException