Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
COM and Access/Assign
Message
De
14/10/1998 18:47:53
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
 
 
À
14/10/1998 18:39:15
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00146877
Message ID:
00146931
Vues:
26
Ignore the last message: it got cut off by accident.

I'm not sure I understand what you mean.

"Collection" is an array of objects.
By adding an Access method to the Array named "Collection", I can use named references. For example, let's say I have a object that we will call oBiz. oBiz has a property DataObjects(1). Each object in Dataobjects has a property cname.

If I have code in my Access method like this (an ugly example):

LPARAMETERS nIndex1
IF VARTYPE(nIndex1)="C"
FOR nCounter=1 TO ALEN(this.dataobjects)
IF this.dataobjects(nCounter).cname=nIndex1
nIndex1=nCounter
EXIT
ENDIF
ENDFOR
ENDIF
RETURN IIF(VARTYPE(nIndex1)="C",this.dataobjects(nIndex1),.NULL.)

then I can use strings when calling my "collection":

If I ask for oBiz.oDataObjects("MyObject") I will get back whichever object in the collection has the value "MyObject" for cname, or NULL if none of them do.

Likewise, I can reference a property of the object in my collection, i.e.

oBiz.dataobjects("MyObject").myproperty

because VFP will intercept the call to the dataobjects property prior to checking the value of myproperty. This is good behavior.

But if you try the same experiment using the class as a COM object it doesn't work.

So I'm not sure what you mean by Obj.Collection="Name". Collection is an Array.

I think what you are saying is that if I wrote a Get-type method, like:

oBiz.getdataobject:

LPARAMETERS cObjName
RETURN oBiz.dataobjects(cObjName)

then this would work. Which is fine if I want stateless COM objects, I suppose.

Is this what you mean?

Eric Shaneson
Cutting Edge Consulting

>
>>Eric,
>>
>>Youa re trying to address a property as if it was a method. Your assign will fire if you;
>>
>>Obj.Collection = "Name"
>>
>>You probably want a method to call to return the value for you.
Eric Shaneson
Cutting Edge Consulting
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform