Table of Contents

Property AssignHotKeys

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

AssignHotKeys

If true, unique hotkeys will automatically be assigned to focusable subviews that have a Title but no HotKey defined.

UsedHotKeys will be used to ensure unique keys are assigned. Set UsedHotKeys before adding subviews with any hotkeys that may conflict with other Views.

public bool AssignHotKeys { get; set; }

Property Value

bool

Remarks

When enabled, hotkeys are assigned to subviews when they are added via Add(View?). The assignment algorithm:

<ol><li>
        Checks if the subview already has a programmatically set <xref href="Terminal.Gui.ViewBase.View.HotKey" data-throw-if-not-resolved="false"></xref>; if so and the key is not
        already used, preserves that hotkey
    </li><li>
        If no usable programmatic <xref href="Terminal.Gui.ViewBase.View.HotKey" data-throw-if-not-resolved="false"></xref> is found, checks if the subview's <xref href="Terminal.Gui.ViewBase.View.Title" data-throw-if-not-resolved="false"></xref>
        contains a hotkey specifier (e.g., Strings.menuFile) and preserves it if the key is not already used
    </li><li>
        If neither a usable programmatic hotkey nor a usable title specifier is found, assigns a new hotkey
        from the first available character in the title
    </li><li>
        Skips characters that are already in <xref href="Terminal.Gui.ViewBase.View.UsedHotKeys" data-throw-if-not-resolved="false"></xref>, as well as spaces and control
        characters, when determining whether a hotkey is usable or when assigning a new one
    </li></ol>

Call AssignHotKeysToSubViews() to manually trigger hotkey assignment for all subviews.