ftxui::Event
cpp
#include <ftxui/component/event.hpp>Represent an event. It can be key press event, a terminal resize, or more ...
For example:
- Printable character can be created using Event::Character('a').
- Some special are predefined, like Event::ArrowLeft.
- One can find arbitrary code for special Events using: ./example/util/print_key_press For instance, CTLR+A maps to Event::Special({1});
Useful documentation about xterm specification: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Examples: component/canvas_animated, component/custom_loop, component/homescreen, component/input, component/print_key_press
Summary
Static Attributes
ArrowLeft
ArrowRight
cpp
static const Event ArrowRight = Event::Special("\x1B[C");ArrowUp
ArrowDown
ArrowLeftCtrl
cpp
static const Event ArrowLeftCtrl = Event::Special("\x1B[1;5D");ArrowRightCtrl
cpp
static const Event ArrowRightCtrl = Event::Special("\x1B[1;5C");ArrowUpCtrl
cpp
static const Event ArrowUpCtrl = Event::Special("\x1B[1;5A");ArrowDownCtrl
cpp
static const Event ArrowDownCtrl = Event::Special("\x1B[1;5B");Backspace
Delete
Return
Escape
Tab
Examples: component/canvas_animated, component/homescreen, component/modal_dialog_custom, component/tab_horizontal, component/tab_vertical
TabReverse
cpp
static const Event TabReverse = Event::Special({27, 91, 90});Insert
Home
End
PageUp
PageDown
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
a
A
CtrlA
AltA
CtrlAltA
b
B
CtrlB
AltB
CtrlAltB
c
C
CtrlC
AltC
CtrlAltC
d
D
CtrlD
AltD
CtrlAltD
e
E
CtrlE
AltE
CtrlAltE
f
F
CtrlF
AltF
CtrlAltF
g
G
CtrlG
AltG
CtrlAltG
h
H
CtrlH
AltH
CtrlAltH
i
I
CtrlI
AltI
CtrlAltI
j
J
CtrlJ
AltJ
CtrlAltJ
k
K
CtrlK
AltK
CtrlAltK
l
L
CtrlL
AltL
CtrlAltL
m
M
CtrlM
AltM
CtrlAltM
n
N
CtrlN
AltN
CtrlAltN
o
O
CtrlO
AltO
CtrlAltO
p
P
CtrlP
AltP
CtrlAltP
q
Q
CtrlQ
AltQ
CtrlAltQ
r
R
CtrlR
AltR
CtrlAltR
s
S
CtrlS
AltS
CtrlAltS
t
T
CtrlT
AltT
CtrlAltT
u
U
CtrlU
AltU
CtrlAltU
v
V
CtrlV
AltV
CtrlAltV
w
W
CtrlW
AltW
CtrlAltW
x
X
CtrlX
AltX
CtrlAltX
y
Y
CtrlY
AltY
CtrlAltY
z
Z
CtrlZ
AltZ
CtrlAltZ
Custom
Public Attributes
screen_
cpp
ScreenInteractive * screen_ = nullptr;mouse
cpp
struct Mouse mouse;Examples: component/canvas_animated
cursor
cpp
struct Cursor cursor;cursor_shape
cpp
int cursor_shape;Static Functions
CursorPosition
cpp
static Event CursorPosition(std::string, int x, int y);CursorShape
cpp
static Event CursorShape(std::string, int shape);An event corresponding to a terminal DCS (Device Control String).
Public Member Functions
operator==
cpp
bool operator==(const Event & other) const;operator!=
cpp
bool operator!=(const Event & other) const;operator<
cpp
bool operator<(const Event & other) const;input
cpp
const std::string & input() const;Examples: component/print_key_press
is_character
cpp
bool is_character() const;character
cpp
std::string character() const;Examples: component/input
is_mouse
cpp
bool is_mouse() const;Examples: component/canvas_animated
mouse
cpp
struct Mouse & mouse();is_cursor_position
cpp
bool is_cursor_position() const;cursor_x
cpp
int cursor_x() const;cursor_y
cpp
int cursor_y() const;is_cursor_shape
cpp
bool is_cursor_shape() const;cursor_shape
cpp
int cursor_shape() const;DebugString
cpp
std::string DebugString() const;Return a string representation of the event.