Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an Object reference from an _Access method?
Message
De
23/06/2009 17:24:09
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01407874
Message ID:
01407903
Vues:
61
Actually, nevermind. It works exactly like what I was expecting it to, which is that it *DOES* pass back the object reference.

For one, I had a typo in my code when I was trying to read a property name on the object, and two, the watch window in the debugger does not display the values from the object because of the _Access method trick, I guess. But they do evaluate correctly at run time.

The Watch window says "(Expression could not be evaluated)".

Interestingly, when I Mouse Over the variable namein the trace window, it does show the value, even though the Watch window does not.

Anyway, the only problem was that I just didn't spell the property name correctly, so the message in the Watch window made me think it wouldn't work, but it does eval fine.

Thanks VFP. Your smart!



>Can you just create a method, say, getObjectReference in the container and do
>this.oObject = this.textbox.oObject there instead?
>
>
>>I have a textbox class that has a custom oObject property that is instantiated on it in the init() method.
>>
>>I have now used that textbox in a Container class, and I want to expose an oObject property on the Container that will pass back the oObject that is on the child textbox.
>>
>>So, I made a property on the container called oObject, and I set the _Access method with this code:
>>
>>
>>Return this.TextBox.oObject
>>
>>
>>However, when I try to code against the container oObject property, it is returning null, but I know from debugging that the TextBox.oObject is a good object.
>>
>>I've tried the following:
>>
>>
>>loCustomer=containerCustomer.oObject
>>lcCustNo=loCustomer.cust_num
>>
>>
>>and
>>
>>
>>lcCustNo=containerCustomer.oObject.cust_num
>>
>>
>>
>>but they both cause en error, and the debugger is reporting that containerCustomer.oObject is null, but container.TextBox.oOjbect is NOT null.
>>
>>Why will it not pass though like I am intending.
>>
>>I do not want to create a mechanism to actually update the container oObject with a full copy of the target object, I just want a pass-though behavior.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform