Hi,
I have been using B4A for a few months now and there is just one thing that has been puzzling me.
If a non-primative variable which has been dimed as local inside a sub is referenced from a global variable, why does it still hold the reference when the sub has ended.
I would have expected BaseList.cBase to lose the reference when Newc goes out of scope, or am I being a complete idiot.
Please dont shout at me, I have a headache.
Terry
I have been using B4A for a few months now and there is just one thing that has been puzzling me.
If a non-primative variable which has been dimed as local inside a sub is referenced from a global variable, why does it still hold the reference when the sub has ended.
B4X:
Sub NewGauge(X As Int,y As Int,w As Int,h As Int)
Dim Newp As Panel
Dim Newc As Canvas
Dim Newgb As GaugeBase ' Custom type
Newgb.Initialize
Newp.Initialize("Gauge")
Activity.AddView(Newp,X,y,w,h)
Newc.Initialize(Newp)
Newgb.cBase = Newc
Newgb.pBase = Newp
Newgb.pBase.Tag = Id
BaseList.Add(Newgb)
End Sub
I would have expected BaseList.cBase to lose the reference when Newc goes out of scope, or am I being a complete idiot.
Please dont shout at me, I have a headache.
Terry