Table of Contents

Property CommandView

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

CommandView

Gets or sets the View that displays the command text and hotkey.

public View CommandView { get; set; }

Property Value

View

Examples

This example illustrates how to add a Shortcut to a StatusBar that toggles the Force16Colors property.

var force16ColorsShortcut = new Shortcut
{
    Key = Key.F6,
    KeyBindingScope = KeyBindingScope.HotKey,
    CommandView = new CheckBox { Text = "Force 16 Colors" }
};
var cb = force16ColorsShortcut.CommandView as CheckBox;
cb.Checked = Application.Force16Colors;

cb.Toggled += (s, e) => { var cb = s as CheckBox; Application.Force16Colors = cb!.Checked == true; Application.Refresh(); }; StatusBar.Add(force16ColorsShortcut);

Remarks

By default, the Title of the CommandView is displayed as the Shortcut's command text.

By default, the CommandView is a View with CanFocus set to false.

Setting the CommandView will add it to the Shortcut and remove any existing CommandView.