class Crysterm::Event::KeyPress

Overview

Individual key events emitted on specific key presses. This is used when the caller does not want to listen for everything on Event::KeyPress (i.e. all keypresses), but when they want explicit keys like Event::KeyPress::CtrlQ.

Direct Known Subclasses

Defined in:

event.cr

Constant Summary

KEYS = {} of ::Tput::Key => self.class

This macro takes all enum members from Tput::Key and creates a KeyPress::<member> event for them, such as Event::KeyPress::CtrlQ.

This is done as a convenience, so that users would not have to listen for all keypresses and then manually check for particular keys every time.

Constructors

Instance Method Summary

Constructor Detail

def self.new(char : Char, key : Tput::Key | Nil = nil, sequence : Array(Char) = [char]) #

[View source]

Instance Method Detail

def accept #

Accepts event and causes it to stop propagating.


[View source]
def accepted=(accepted : Bool) #

[View source]
def accepted? : Bool #

[View source]
def char : Char #

[View source]
def char=(char : Char) #

[View source]
def ignore #

Ignores event and causes it to continue propagating.


[View source]
def key : Tput::Key | Nil #

[View source]
def key=(key : Tput::Key | Nil) #

[View source]
def sequence : Array(Char) #

[View source]
def sequence=(sequence : Array(Char)) #

[View source]