Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unexpected behavior (bug?) in collections and AMEMBERS
Message
De
05/03/2004 12:35:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00883536
Message ID:
00883574
Vues:
7
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform