widget:global_state: remove usage of navigate

* this needs to be adopted to use event handler code

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2021-03-06 15:19:33 +01:00
parent ba3a6fb4d3
commit 55040e37cf
2 changed files with 9 additions and 9 deletions

View File

@@ -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.

View File

@@ -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::<TicketdataView>(0).
//ctx.get_widget(self.ticketdata_view);
}