From 9fc4c6c01d5e4f877bac7bd479b766894846b8ed Mon Sep 17 00:00:00 2001 From: Ralf Zerres Date: Sat, 6 Mar 2021 15:19:33 +0100 Subject: [PATCH] widget:global_state: remove usage of `navigate` * this needs to be adopted to use event handler code Signed-off-by: Ralf Zerres --- advotracker/src/widgets/global_state.rs | 16 ++++++++-------- .../src/widgets/policycheck/policycheck_state.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/advotracker/src/widgets/global_state.rs b/advotracker/src/widgets/global_state.rs index cb27152..2f8eba3 100644 --- a/advotracker/src/widgets/global_state.rs +++ b/advotracker/src/widgets/global_state.rs @@ -61,14 +61,14 @@ pub trait GlobalState { Some(text) } - /// Navigates to the given entity. - fn navigate(&self, to: Entity, ctx: &mut Context<'_>) { - if let Some(old_focused_element) = *Window::focus_state_ref(&ctx.window()).focused_entity() { - ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element)); - } - ctx.widget().set("visibility", Visibility::Collapsed); - ctx.get_widget(to).set("visibility", Visibility::Visible); - } + // /// Navigates to the given entity. + // fn navigate(&self, to: Entity, ctx: &mut Context<'_>) { + // if let Some(old_focused_element) = *Window::focus_state_ref(&ctx.window()).focused_entity() { + // ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element)); + // } + // ctx.widget().set("visibility", Visibility::Collapsed); + // ctx.get_widget(to).set("visibility", Visibility::Visible); + // } /// Save the our data structure and convert it to `ron` file format. /// The cargo package identifier (here: 'nwx.advotracker') is taken to create the app directory. diff --git a/advotracker/src/widgets/policycheck/policycheck_state.rs b/advotracker/src/widgets/policycheck/policycheck_state.rs index eaaf861..793eefa 100644 --- a/advotracker/src/widgets/policycheck/policycheck_state.rs +++ b/advotracker/src/widgets/policycheck/policycheck_state.rs @@ -181,7 +181,7 @@ impl PolicycheckState { /// Create new ticket pub fn new_ticket(&mut self, ctx: &mut Context<'_>) { println!("WIP: new ticket."); - self.navigate(self.ticketdata, ctx); + self(ticketdata_view.0); //ctx.widget().get_mut::(0). //ctx.get_widget(self.ticketdata_view); }