Expand description
Raw keyboard hardware events, received independent of what window or widget is focused.
You must enable device events in the app to receive this events.
use zng::app::raw_device_events::InputDeviceCapability;
use zng::prelude::*;
APP.defaults().run_window(async {
APP.device_events_filter().modify(|f| f.input |= InputDeviceCapability::KEY);
keyboard::raw_device_events::KEY_EVENT
.on_pre_event(hn!(|args| {
if args.state == keyboard::KeyState::Pressed {
println!("key pressed {:?}", args.key_code);
}
}))
.perm();
Window!()
});Structs§
Statics§
- KEY_
EVENT - Keyboard device key press.