pub fn dispatch_event_envelope_to_target<A: 'static>(
tree: &ElementTree<A>,
runtime: RuntimeHandle<A>,
target: ElementId,
envelope: &EventEnvelope,
)Expand description
Synchronously dispatches one envelope to one widget without bubbling.
The envelope’s EventMeta is cloned into the callback context. Unknown
targets, non-widget elements, and elements without committed layout are
silently ignored.
§Examples
use std::time::Duration;
use ailloli_ui_core::{event::{Event, FocusEvent}, ElementId};
use ailloli_ui_runtime::{app::{PresentationGeneration, RuntimeHandle}, element::ElementTree, input::{dispatch_event_envelope_to_target, EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(
EventMeta::new(EventId::new(1), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL),
Event::Focus(FocusEvent::new(true)),
);
dispatch_event_envelope_to_target(&ElementTree::<()>::new(), RuntimeHandle::new(), ElementId(1), &envelope);