procedure popup is called on a view when it is activated and is not called when switching views

close_panel is called when closing and not when switching views