Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexpected behavior (bug?) in collections and AMEMBERS
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00883536
Message ID:
00883553
Views:
7
Hi Paul,

It's known problem. See Re: For Each rotation changes type in collection Thread #843966 Message #844014

>I've run into a weird situation with objects being added to a collection and using AMEMBERS with it. Here's some sample code which shows the problem:
>
>
>LOCAL loCollection
>?"-------------------"
>loCollection = CREATEOBJECT("Collection")
>loItem = CREATEOBJECT("Empty")
>ADDPROPERTY(loItem, "TestProp", "Test")
>?AMEMBERS(laTest, loItem)
>
>loCollection.Add(loItem)
>
>FOR EACH loCollItem IN loCollection
>    ? "This fails:"
>    ?AMEMBERS(laCollTest, loCollItem)
>    ?
>    ? "This works:"
>    ?loCollItem.TestProp
>    ?AMEMBERS(laCollTest, loCollItem)
>ENDFOR
>
>
>Basically, what I'm seeing is that until I actually access a property in the item in the collection, AMEMBERS doesn't see any of the properties. So, on the "This fails:" line I'm seeing a count of 0 (it should be 1), and once I access the property, it returns 1.
>
>What's up with this?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform