Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OCollection_ASSIGN Problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01219959
Message ID:
01219966
Views:
22
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform