Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing an object using a variable for the object na
Message
 
 
À
15/08/2001 14:48:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00544237
Message ID:
00544328
Vues:
14
>Hello,
>
>I'm having a problem trying to figure out how to reference objects and object arrays when you are using variables instead of actual names. For example, consider the following procedure. In this situation, I need to (1) check to see if an object exists, and then (2) generate this object if it doesn't exist, and (3) run a procedure using an array that is a property of the newly created object. I'm not sure how to reference the array using a variable, or how to pass the array as reference, since @ doesn't work here. I am only getting the first element of the array.
>
>PROC MYPROC
>
>lParameter lcObjectClass
>Local loObject, loArray
>loObject = "o" + m.lcObjectClass
>
>
>* Check to see if object exists
>
>IF (TYPE("THIS." + m.loObject) <> "O")
>	THIS.AddObject(m.loObject, m.lcObjectClass)
>ENDIF
>
>* Get array reference (is there a better way to do this? This works but seems a little clumsy.)
>
loObject=evaluate('this.'+m.loObject)
with m.loObject
  =acopy(m.loObject.Array,aTempArray)  
  this.DoSomething(@aTempArray) && this does not work, array does not pass by 
  =acopy(aTempArray,m.loObject.Array)  
endwith
>
>ENDPROC
>
>Thanks for any tips,
>
>Linda Swift
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform