Android Question a question about initializing variables using type defs.

Henry Baars

Member
Licensed User
Longtime User
Sub Class_Globals

Type Parameter ( _
dX As Int, _
dY As Int, _
v As Int )
Type Position ( _
a As Parameter, _
b As Parameter, _
c As Parameter )
Dim TP As Position

End Sub

Public Sub Initialize ‘initialize is called from LG_Create
TP.a.dX = 0
End Sub

What am I missing here? Obviously I do not initialize something correctly (or not at all) since the application crashes when I try to fill TP.a.dX with 0, but I think that the Dim TP would (should?) also automatically dim the parameter types a, b and c inside?

How do I get this right?

What I am trying to do here is to avoid the next ugly construction:
Type Position ( _
adx As int, _
adY As int, _
aV As int, _

bdx As int, _
bdY As int, _
bV As int, _

cdx As int, _
cdY As int, _
cV As int, _

etc…

The complete Position Type declaration runs from a to ccc (a total of 165 definitions!) So, it would be VERY nice to get this right, especially because it is very likely that the Parameter type will be expanded later on during development with approximately 8 additional parameters.
 

Henry Baars

Member
Licensed User
Longtime User
You need to do:
TP.Initialize
TP.a.Initialize
TP.b.Initialize

i.e. initialize any type structure even when it is nested.

This one again shows the difference between using a development language and truly understanding it :-(
I thought the Dim was doing the initialize for me, but obviously there two different things.

Thank you desolatesoul. Initializing did solved the problem.
 
Upvote 0
Top