Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array Type in Collection
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01299120
Message ID:
01299131
Views:
17
This message has been marked as the solution to the initial question of the thread.
Looks like a bug (or undocumented limitation) of TYPE() function. It works if you retrieve stored object first.
The ALEN works fine if you reference collection correctly.
DEFINE CLASS obox as Collection 
	PROCEDURE addball
		LPARAMETERS toIn
		this.Add(toIn)
		? this.Item(1).alist[1], ;
			TYPE("this.Item(1).alist",1), ;
			ALEN(this.Item(1).alist)
		* Type() works here
		oBall = this.Item(1)
		? TYPE("oBall.alist",1)
	
	ENDPROC 
ENDDEFINE
>Is there a way to access an array as an array within an object once you stick it into a collection?
>
>The function alen() fails when I use it on an array property within an object that is added to a collection object. The code below shows the scenario. The first messagebox shows that the type of aList is "C". When I try to access the aList of the object inside the collection, I get type "U". I must be missing something....
>
>Thanks in advance...
>
>George Scapin
>
>
>mybox = CREATEOBJECT("obox")
>myball1=CREATEOBJECT("oball", "1 inch", "blue/white", "hard")
>mybox.addball(myball1)
>
>DEFINE CLASS oball as Custom
>	PROCEDURE init
>		LPARAMETERS cSize, cColor, cHardness
>		this.AddProperty('aList(1)')
>		DIMENSION this.alist[3,2]
>		this.alist[1,1] = "SIZE"
>		this.alist[1,2] = cSize
>		this.alist[2,1] = "COLOR"
>		this.alist[2,2] = cColor
>		this.alist[3,1] = "HARDNESS"						
>		this.alist[3,2] = cHardness
>	ENDPROC
>	
>ENDDEFINE
>
>DEFINE CLASS obox as Collection
>	PROCEDURE addball
>		LPARAMETERS toIn
>		MESSAGEBOX(TYPE("toIn.alist",1))
>		this.Add(toIn)
>		MESSAGEBOX(TYPE("mybox(1).alist",1))
>	ENDPROC
>ENDDEFINE
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform