struct TUI::KeyMenu::Binding

Overview

One registered binding: #trigger is the key/char #dispatch matches against, #label is the exact text #hint shows for it, #when an optional guard that must return true for the binding to be active (nil means always active), #action the callback #dispatch invokes on a match.

Defined in:

tui/widget/key_menu.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(trigger : Key | Char, label : -> String, when : -> Bool | Nil, action : KeyEvent -> Nil) #

[View source]

Instance Method Detail

def action : KeyEvent -> Nil #

def clone #

[View source]
def copy_with(trigger _trigger = @trigger, label _label = @label, when _when = @when, action _action = @action) #

[View source]
def label : -> String #

def trigger : Key | Char #

def when : -> Bool | Nil #