pub fn UnhandledKeyEvents(handler: impl Fn(&KeyEvent) -> bool + 'static)Expand description
Hands handler every key event no control took: none was focused, a
focused control let the key pass, and no text field is taking typing.
This is where an application puts the shortcuts that work anywhere in it,
a media player’s play and stop keys, for instance. The handler returns
true for a key it used. While several are composed, the one composed
last is asked first, and a key goes no further once one takes it.
ⓘ
UnhandledKeyEvents(move |event| {
if event.event_type != KeyEventType::KeyDown {
return false;
}
match event.key_code {
KeyCode::X => { play(); true }
KeyCode::V => { stop(); true }
_ => false,
}
});