Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexpected behavior (bug?) in collections and AMEMBERS
Message
From
05/03/2004 12:35:40
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00883536
Message ID:
00883574
Views:
6
try this:
LOCAL loCollection
CLEAR
?"-------------------"
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

* but this is ok
FOR liCollItem=1 TO loCollection.count
    ? "This fails:"
    ?AMEMBERS(laCollTest, loCollection[m.liCollItem])
    ?
    ? "This works:"
    ?loCollection[m.liCollItem].TestProp
    ?AMEMBERS(laCollTest, loCollection[m.liCollItem])
ENDFOR 
Paul, cancel FOR EACH from your mind, and your life will improve sure.

Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform