Expand description
Keyboard service, properties, events and other types.
The example below defines a window that shows the pressed keys and prints the key state changes.
use zng::prelude::*;
Window! {
child = Text!(keyboard::KEYBOARD.keys().map_debug());
keyboard::on_key_input = hn!(|args: &keyboard::KeyInputArgs| {
println!("key {:?} {:?}", args.key, args.state);
});
}
Keyboard events are send to the focused widget, if there is no focused widget no event is send. You can
subscribe directly to the KEY_INPUT_EVENT
to monitor all keyboard events for any focused widget.
§Full API
See zng_ext_input::keyboard
and zng_wgt_input::keyboard
for the full keyboard API.
See zng_app::view_process::raw_events
for raw keyboard events that are processed to generate the key input event.
Modules§
- Raw keyboard hardware events, received independent of what window or widget is focused.
Structs§
- Keyboard service.
- Arguments for
KEY_INPUT_EVENT
. - System settings that define the key pressed repeat.
- Arguments for
MODIFIERS_CHANGED_EVENT
. - Represents the current state of the keyboard modifiers.
Enums§
- Key represents the meaning of a key press.
- Represents the location of a physical key.
- The location of the key on the keyboard.
- State a
Key
has entered. - Contains the platform-native physical key identifier
Statics§
- Key pressed, repeat pressed or released event.
- Modifiers key state changed event.
Traits§
- Extension trait that adds keyboard simulation methods to
HeadlessApp
.
Functions§
P
Event fired when a keyboard key is pressed or released and the widget is disabled.P
Event fired when a keyboard key is pressed and the widget is enabled.P
Event fired when a keyboard key is pressed or released and the widget is enabled.P
Event fired when a keyboard key is released and the widget is enabled.P
Previewon_disabled_key_input
event.P
Previewon_key_down
event.P
Previewon_key_input
event.P
Previewon_key_up
event.