Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection object and not all of This
Message
From
04/10/2014 14:44:16
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
04/10/2014 14:21:18
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01608770
Message ID:
01608771
Views:
60
Just a thought but "This.Parameters" is an object and this line This.Parameters(m.lcKey) looks like a method call. Shouldn't it look like this This.Parameters.GetKey(m.lcKey) ?

>Dear All
>
>I was working with a class that involved a Collection added at run time. I encountered a problem that I eventually managed to circumvent, but I would like to understand what was I doing wrong, if anything, with my original design.
>
>At first, I thought of a scope problem, but strangely I was able to access the Collection properties. What failed with me was that I couldn't (and cannot) access its items by any mean.
>
>I wrote a small program that reproduces my problem, with the help of the Debugger. If anyone is willing to give me a hand on this, I would ask to run the program and, when the debugger is launched and the program suspended, to insert the following watches (they are refered in the program so it will be easy to select each expression in the code and move it to the Watch field):
>
>This.Parameters.Count
>This.Parameters.GetKey(1)
>This.Parameters(m.lcKey)
>This.Parameters.Item(1)
>m.lnCount
>m.lcKey
>m.lnValueK
>m.lnValueN
>
>Afterwards, the program can be resumed a line at a time, and what I observed is that the variables got the expected values but all others watches could not be evaluated, with the exception of This.Parameters.Count that evaluated correctly to 3.
>
>My question is: what can explain this behavior of the items being inaccessible, athough the other properties of the Collection can be accessed - including the number of items in the Collection?
>
>The program:
>
>m.loObject = CREATEOBJECT("someClass")
>m.loObject.SetParameter("id", 1)
>m.loObject.SetParameter("model", "Model name")
>m.loObject.SetParameter("description", "Model description")
>m.loObject.someMethod()
>
>DEFINE CLASS someClass as Custom
>
>	Parameters = .NULL.
>
>	FUNCTION SetParameter
>		LPARAMETERS tcId, teValue
>
>		IF ISNULL(This.Parameters)
>			This.Parameters = CREATEOBJECT("Collection")
>		ENDIF
>
>		This.Parameters.Add(m.teValue, m.tcId)
>	ENDFUNC
>
>	FUNCTION someMethod
>
>		SET STEP ON
>		m.lnCount = This.Parameters.Count
>		m.lcKey = This.Parameters.GetKey(1)
>		m.lnValueK = This.Parameters(m.lcKey)
>		m.lnValueN = This.Parameters.Item(1)
>		m.lcDummy = "" && just to show the watches in the debugger
>
>	ENDFUNC
>
>ENDDEFINE
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform