Structure Struct
Title.s
List Childs.Struct()
EndStructure
Global num = 0
Global NewList Virtual.Struct()
Global NewMap Boxes()
Procedure _Add(List lList.Struct())
*ptr = AddElement(lList())
lList()\Title = "V" + Str(num)
num = num + 1
ProcedureReturn *ptr
EndProcedure
_Add(Virtual())
_Add(Virtual()\Childs())
_Add(Virtual()\Childs())
*element = _Add(Virtual()\Childs()\Childs())
SelectElement(Virtual(), 0)
Debug "1>" + Virtual()\Title
ChangeCurrentElement(Virtual(), *element )
Debug "2>" + Virtual()\Title ; Ok!
; Need to add to *element
AddElement(Virtual()) ; Must be in Virtual()\Childs()\Childs()
Virtual()\Title = "V333" ; NOT OK!
; Need to go through the address *element
ForEach Virtual()
Debug Virtual()\Title ; NOT OK!
Next
ChangeCurrentElement(Virtual(), *element ) can only change the direct elements in the list, not the nested ones.
But you can use *element with a structure:
Structure Struct
Title.s
List Childs.Struct()
EndStructure
Global num = 0
Global NewList Virtual.Struct()
Global NewMap Boxes()
Procedure _Add(List lList.Struct())
*ptr = AddElement(lList())
lList()\Title = "V" + Str(num)
num = num + 1
ProcedureReturn *ptr
EndProcedure
_Add(Virtual())
_Add(Virtual()\Childs())
_Add(Virtual()\Childs())
Define *element.Struct = _Add(Virtual()\Childs()\Childs())
SelectElement(Virtual(), 0)
Debug "1>" + Virtual()\Title
Debug "2>" + *element\Title ; Ok!
; Need to add to *element
AddElement(*element\Childs()) ; Must be in Virtual()\Childs()\Childs()
*element\Childs()\Title = "V333" ; NOT OK!
; Need to go through the address *element
ForEach *element\Childs()
Debug *element\Childs()\Title ; NOT OK!
Next