zng_wgt::node

Function event_state2

source
pub fn event_state2<A0, A1, S0, S1, S>(
    child: impl UiNode,
    state: impl IntoVar<S>,
    default: S,
    event0: Event<A0>,
    default0: S0,
    on_event0: impl FnMut(&A0) -> Option<S0> + Send + 'static,
    event1: Event<A1>,
    default1: S1,
    on_event1: impl FnMut(&A1) -> Option<S1> + Send + 'static,
    merge: impl FnMut(S0, S1) -> Option<S> + Send + 'static,
) -> impl UiNode
where A0: EventArgs, A1: EventArgs, S0: VarValue, S1: VarValue, S: VarValue,
Expand description

Helper for declaring state properties that depend on two other event states.

When the event# is received on_event# is called, if it provides a new value merge is called, if merge provides a new value the state variable is set.