Function zng::keyboard::on_key_down

source ·
pub fn on_key_down(
    child: impl UiNode,
    handler: impl WidgetHandler<KeyInputArgs>,
) -> impl UiNode
Expand description

P Event fired when a keyboard key is pressed and the widget is enabled.

§Route

The event is raised in the keyboard focused widget and then each parent up to the root. If propagation stop is requested the event is not notified further. If the widget is disabled or blocked the event is not notified.

This route is also called bubbling.

§Keys

Any key press generates a key down event, including keys that don’t map to any virtual key, see KeyInputArgs for more details.

For key combinations consider using a click_shortcut with a click handler.

§Underlying Event

This event property uses the KEY_INPUT_EVENT that is included in the default app.

§Preview

You can preview this event using on_pre_key_down. Otherwise the handler is only called after the widget content has a chance to stop propagation.

§Async

You can use async event handlers with this property.