HI, All
If a B4X class contains other B4X classes and the instances are created runtime - if they are views, usually they need to be:
If object id is stored in a variable - nullification of variable does not help.
.IsInitialized of each created instance is always = True.
How correctly in B4J to destroy such structure and free memory up for sure ? For re-creation again of a fresh set.
If a B4X class contains other B4X classes and the instances are created runtime - if they are views, usually they need to be:
- created: init\create\show each instance of sub-classes
- shown in an interface (and resized)
- updated in an interface (and resized)
- maybe moved by user
- and destroyed
If object id is stored in a variable - nullification of variable does not help.
.IsInitialized of each created instance is always = True.
B4X:
Dim objs As List
...
Private Sub butRefresh_Click
Editor.RemoveAllViews
Init_Area
For i = 0 To objs.Size - 1
Dim obj As b4xVectEdit_component = objs.Get(i)
obj = Null ' does not help
Next
Generate_Diagram
End Sub
Sub Generate_Diagram
If b4xVectEdit_component1.IsInitialized = False Then
objs.Add(b4xVectEdit_component1.Initialize(Me, "Unit1"))
b4xVectEdit_component1.Name = "Unit1"
b4xVectEdit_component1.DesignerCreateView(Editor, Null, Null)
End If
b4xVectEdit_component1.Base_Resize(500dip, 500dip)
If b4xVectEdit_component2.IsInitialized = False Then
objs.Add(b4xVectEdit_component2.Initialize(Me, "Unit2"))
b4xVectEdit_component2.Name = "Unit2"
b4xVectEdit_component2.DesignerCreateView(Editor, Null, Null)
End If
b4xVectEdit_component2.Base_Resize(100dip, 300dip)
If b4xVectEdit_component3.IsInitialized = False Then
objs.Add(b4xVectEdit_component3.Initialize(Me, "Unit3"))
b4xVectEdit_component3.InternalView = True
b4xVectEdit_component3.Name = "Unit3_internal"
b4xVectEdit_component3.DesignerCreateView(b4xVectEdit_component1.mRect.mBase, Null, Null)
End If
b4xVectEdit_component3.Base_Resize(200dip, 220dip)
b4xVectEdit_component3.mRoot.Left = 65dip
End Sub
How correctly in B4J to destroy such structure and free memory up for sure ? For re-creation again of a fresh set.
Last edited: