Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OCollection_ASSIGN Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01219959
Message ID:
01219966
Vues:
24
The _Assign method only fires when property is changed. Adding items to collection doesn't change its reference stored in the property .oTabs. You can create a subclass of Collection with overriten Add method.
CLEAR
o =  CREATEOBJECT("MyCollection")
= o.Add("Apple")
= o.Add("Orange")
= o.Add("Banana",,2)
? o.Item(1)
? o.Item(2)
? o.Item(3)
RETURN

DEFINE CLASS mycollection as Collection
	FUNCTION Add(eItem, cKey, eBeforere, eAfter)
		? "Added " + eItem
	ENDFUNC
ENDDEFINE
>I want to trap when the code adds an object to a collection.
>
>I have a property, 'oTab's, which has an assign method. In the Init I have:
>
>
>.oTabs = CREATEOBJECT("Collection")
>
>
>The _Assign method only fires when this line of code fires, not when
>items are added to the collection.
>
>Any way to do this?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform