pub fn on_event<C, A, F>(
child: C,
event: Event<A>,
filter: F,
handler: Box<dyn FnMut(&A) -> HandlerResult + Send>,
) -> UiNodeExpand description
Helper for declaring event properties.
This function is used by the event_property! macro.
§Filter
The filter predicate is called if propagation was not stopped. It must return true if the event arguments are
relevant in the context of the widget. If it returns true the handler closure is called. Note that events that represent
an interaction with the widget are send for both ENABLED and DISABLED targets, event properties should probably distinguish
if they fire on normal interactions vs on disabled interactions.
§Route
The event handler is called after the on_pre_event equivalent at the same context level. If the event
filter allows more then one widget and one widget contains the other, the handler is called on the inner widget first.
§Async
Async event handlers are called like normal, but code after the first .await only runs in subsequent updates. This means
that propagation must be stopped before the first .await, otherwise you are only signaling
other async tasks handling the same event, if they are monitoring the propagation handle.
§Commands
You can use on_command to declare command event properties.