widgets/policycheck_view: template id's

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2020-08-22 19:03:52 +02:00
parent 70e2e7f1e5
commit 5aff69c526

View File

@@ -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::<PolicyCheckState>(policycheck_view)
//ctx.get_mut::<PolicyCheckState>(policycheck_state)
ctx.get_mut::<PolicyCheckState>(id)
.action(Action::OpenMenu(policy_check_label_menu));
true
})
@@ -145,10 +147,13 @@ impl Template for PolicyCheckView {
.water_mark("10-stellig")
.on_activate(move |ctx, entity| {
// Entity is entered/activated via Mouse/Keyboard
ctx.get_mut::<PolicyCheckState>(policycheck_view)
//ctx.get_mut::<PolicyCheckState>(policy_check_view)
println!("ParseEntry: {:?}", entity);
ctx.get_mut::<PolicyCheckState>(id)
.action(Action::ParseEntry(entity));
})
//.on_changed(move |ctx, entity| {
//.on_changed(|_, entity, _, _| println!("Selection changed: {:?}", entity))
// .on_changed(move |ctx, entity, _| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetProgressBox(entity));
// ctx.get_mut::<PolicyCheckState>(id)
@@ -157,10 +162,10 @@ impl Template for PolicyCheckView {
// .action(Action::InputTextChanged(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetVisibility(entity));
// //ctx.get_widget(policy_check_label_policy_number).set("visible");
// // ctx.get_mut::<PolicyCheckState>(id)
// // .action(Action::SetVisility(entity));
//})
// ctx.get_widget(policy_check_label_policy_number).set("visible");
// ctx.get_mut::<PolicyCheckState>(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)
//}