Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Storing/assigning a value by reference
Message
De
09/04/1999 12:17:40
 
 
À
09/04/1999 10:51:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206498
Message ID:
00206934
Vues:
14
>This is what my VB friend (actually, TechSupport at Mapinfo) said:
>>>
>In VB, SET creates a pointer to the object on the right side of the equals sign.
>You could also say this as: SET gets an object into a variable by reference.
>
>So armed with this knowledge, is there a way to set a pointer on the left to an object on the right in VFP?

Well, the way that variables values are stored and the way that references to objects are stored in VFP is different. When you assign an object to a variable in VFP, you are assigning it by reference. This is different from regular variables. IOW, the following is true in VFP

loObj = CREATEOBJECT('SomeObject')
NewObjRef = loObj
loObj.SomeProp = "Howdy"
?NewObjRef.SomeProp && Returns "Howdy"

Object are _always_ stored and passed by reference in VFP. There is no other way to do it. This is still identical to the way that SET works in VB.


>If so, this is what needs to be done, I believe, to get this to work in VFP.

It appears as if your problem runs deeper than that. I know very little about the internals of ActiveX, but I'm going to guess that the creators of the control didn't follow all of the necessary interface rules that a control has to have to work in VFP.

>oMap=CreateObject('Mapx.Map.2')
>olayer=oMap.Layers["USA"]
>oMap.Layers.AnimationLayer=oLayer
>
>This third line generates a Type Mismatch error in VFP even though the equivalent VB, VC, Access, Delphi, PB, Domino, code apparently works fine.

This code would work fine if all objects were native VFP objects. Your syntax is correct. I would be overstepping my bounds if I were to guess why it doesn't work with this control. Maybe someone here who knows a little more about ActiveX could chime in here.

>You mentioned using an API to create a pointer. Is that the same as the _Store() API referenced in the VFP help?

No. And on learning more about what you are trying to do, I don't think this is the path that you need to be following. If you decide that pointers are what you need, you should download Ed Rauh's CLSHeap class from here. It puts a VFP wrapper around all of the API calls you'll need to create and manipulate pointers in VFP.

Sorry I couldn't be of more help.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform