Property CommandView | Terminal.Gui v2 (original) (raw)

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 theForce16Colors 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

Exceptions

ArgumentNullException