Property HotKey
HotKey
Gets or sets the hot key defined for this view. Pressing the hot key on the keyboard while this view has focus will invoke HotKey. By default, the HotKey is set to the first character of Text that is prefixed with HotKeySpecifier.
A HotKey is a keypress that causes a visible UI item to perform an action. For example, in a Dialog,
with a Button with the text of "_Text" Alt+T
will cause the button to gain focus and to raise its
Accepting event.
Or, in a
Menu with "_File _Edit", Alt+F
will select (show) the "_File" menu. If the "_File" menu
has a
sub-menu of "_New" Alt+N
or N
will ONLY select the "_New" sub-menu if the "_File" menu is already
opened.
View subclasses can use AddCommand(Command, CommandImplementation) to define the behavior of the hot key.
public Key HotKey { get; set; }
Property Value
Remarks
See ../docs/keyboard.md for an overview of Terminal.Gui keyboard APIs.
This is a helper API for configuring a key binding for the hot key. By default, this property is set whenever Text changes.
By default, when the Hot Key is set, key bindings are added for both the base key (e.g. D3) and the Alt-shifted key (e.g. D3. WithAlt). This behavior can be overriden by overriding AddKeyBindingsForHotKey(Key, Key, object?).
By default, when the HotKey is set to 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?).
If the hot key is changed, the HotKeyChanged event is fired.
Set to Empty to disable the hot key.