Hi
Current examples, use a container view and a menu inside an App Drawer.
The menu can call a view, but it only opens it, never closes it. So if you select the same view again, it was always open, and you resume to see the old values. Plus if you have a large number of views, it affects the performance.
What would be the suggested way to close, remove from memory, destroy, the view once you select to go to another view?
thank you
View... how to really close it? destroy, etc.
-
JamesDuignan
- Posts: 85
- Joined: Thu Nov 26, 2015 1:43 pm
Re: View... how to really close it? destroy, etc.
Hi,
So there are is no way currently for the views to be closed, as you have found.
So the way I see it there are two ways you could possibly do this.
A) Use the prepare event in the views to re-initialize the values in the view.
But seeing as how you are talking about actually destroying the instances of each view I think that you may need a little bit more logic for what you want to achieve.
B) dynamically create and destroy the view instances as you need them.
1. Only have a single prim_view defined for the webpage, call it something like "currentview"
2. Use the click events of the menu items, rather than the view property of the menu item to show you views. In the event to cast the definitiions view to "currentview"
Here is an export of how this can be achieved
So there are is no way currently for the views to be closed, as you have found.
So the way I see it there are two ways you could possibly do this.
A) Use the prepare event in the views to re-initialize the values in the view.
But seeing as how you are talking about actually destroying the instances of each view I think that you may need a little bit more logic for what you want to achieve.
B) dynamically create and destroy the view instances as you need them.
1. Only have a single prim_view defined for the webpage, call it something like "currentview"
Code: Select all
Define_Com Class(#prim_view) Name(#CurrentView) Reference(*DYNAMIC) Parent(#ViewContainer)Code: Select all
Evtroutine Handling(#MenuItem1.Click)
Define_Com Class(#View1) Name(#View1) Reference(*DYNAMIC)
If (#CurrentView *IsNot *NULL)
#CurrentView <= *NULL
Endif
#View1 <= *New #View1
#CurrentView <= #View1
#CurrentView.Show
#View1 <= *NULL
EndroutineRe: View... how to really close it? destroy, etc.
This previous forum topic (including the other topics, documents and example code it points to) might help you to understand how to destroy any VL object, including a view : viewtopic.php?f=3&t=1377&p=2830&hilit=destroy#p2830