Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create collections?
Message
From
06/03/1998 13:41:42
 
 
To
06/03/1998 13:34:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00082693
Message ID:
00083079
Views:
27
>>>I want to create an object and need this object keep an array of other objects. How can I do it?
>>>
>>>I mean, how to create a behavior similar to that in pageframes, containers, forms or so, that keeps a collection of objects inside a single object? Even more, how could it keep track of the number of elements?
>>
>>Use property-array and ALEN(thisform.amyarray) will return the number of elements. Any time you add/remove new member, you will redimension this array.
>
>Thanks for your help. But it's not clear enough to me how to achieve what I'm looking 4. Would you please give me a more specific help on this?

oCustom=createobject('MyClass')
oCustom.addobject("Label1","Label")
Dimension oCustom.Mycollection(ALEN(oCustom.Mycollection)+1)
oCustom.Mycollection[ALEN(oCustom.Mycollection)]="Label1"
return

DEFINE Class MyClass AS Custom
Dimension Mycollection(1)
Mycollection[1]="None"
ENDDEFINE
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform