View Full Version : UDT.and.numbers
Michael Clease
07-03-2009, 00:31
I have a simple question
take this
shapes(1).box1.pos.x
I want to change box1 in a for next, can it be done. The example below is just to show what I mean.
For n = 1 to 4
shapes(1).box+STR$(n).pos.x
NEXT
Petr Schreiber
07-03-2009, 00:51
Making box member array of 4 seems the most straightforward way for me in this case :)
Like:
TYPE TXYZ
x AS DOUBLE
y AS DOUBLE
z AS DOUBLE
END TYPE
TYPE TTransform
pos AS TXYZ
END TYPE
TYPE TBoxStuff
box(4) AS TTransform
END TYPE
DIM shapes(4) as TBoxStuff
DIM n as long
%something = 1
For n as long = 1 to 4
shapes(1).box(n).pos.x = %something
NEXT
I think dynamic variable name evaluation ( like the one for function calls ) is not implemented.
Petr
Michael Clease
07-03-2009, 00:56
Thanks Petr
I thought that this problem had come up before and Eros suggested something but it was a long time ago but it does matter if I use another array.
thanks again.