diff --git a/advotracker/src/widgets/policycheck_view.rs b/advotracker/src/widgets/policycheck_view.rs index 7a492fb..8630422 100644 --- a/advotracker/src/widgets/policycheck_view.rs +++ b/advotracker/src/widgets/policycheck_view.rs @@ -28,7 +28,8 @@ widget!( /// The template implementation of the policy check view /// All GUI elements are styled using the "style" attribute referencing to a ron based css impl Template for PolicyCheckView { - fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self { + //fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self { + fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self { let policy_check_bottom_bar = Container::new() //.style(STYLE_BOTTOM_BAR) .attach(Grid::row(4)) @@ -81,7 +82,8 @@ impl Template for PolicyCheckView { //.min_size(16, 16) .h_align("end") .on_click(move |ctx, _| { - ctx.get_mut::(policycheck_view) + //ctx.get_mut::(policycheck_state) + ctx.get_mut::(id) .action(Action::OpenMenu(policy_check_label_menu)); true }) @@ -144,23 +146,26 @@ impl Template for PolicyCheckView { .lost_focus_on_activation(false) .water_mark("10-stellig") .on_activate(move |ctx, entity| { - // Entity is entered/activated via Mouse/Keyboard - ctx.get_mut::(policycheck_view) + // Entity is entered/activated via Mouse/Keyboard + //ctx.get_mut::(policy_check_view) + println!("ParseEntry: {:?}", entity); + ctx.get_mut::(id) .action(Action::ParseEntry(entity)); }) - //.on_changed(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::SetProgressBox(entity)); + //.on_changed(|_, entity, _, _| println!("Selection changed: {:?}", entity)) + // .on_changed(move |ctx, entity, _| { + // ctx.get_mut::(id) + // .action(Action::SetProgressBox(entity)); // ctx.get_mut::(id) // .action(Action::AddProgress(0.5)); // ctx.get_mut::(id) // .action(Action::InputTextChanged(entity)); // ctx.get_mut::(id) // .action(Action::SetVisibility(entity)); - // //ctx.get_widget(policy_check_label_policy_number).set("visible"); - // // ctx.get_mut::(id) - // // .action(Action::SetVisility(entity)); - //}) + // ctx.get_widget(policy_check_label_policy_number).set("visible"); + // ctx.get_mut::(id) + // .action(Action::SetVisility(entity)); + // }) // .on_mouse_down | .on_mouse_move | .on_mouse_up (move |ctx, entity| { // state(id, states).action(Action::AddItem); // }) @@ -313,3 +318,8 @@ impl Template for PolicyCheckView { ) } } + +// helper to request PolicyCheckState +//fn state<'a>(id: Entity, states: &'a mut StatesContext) -> &'a mut PolicyCheckState { +// states.get_mut(id) +//}