Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
 
 
À
27/08/2007 18:26:18
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01250681
Message ID:
01250875
Vues:
13
>>>I obviously did not understand the "reference" part of all that. I wish I understood why this doesn't work.
>>
>>Ok, I'll try one more time.
>>
>>When you add an object to the form (or any container object), the object now have an access to the form and its methods/properties.
>>
>>If you add a reference to the object created with createobject syntax, this object doesn't know the object it's being added as a reference to and thus can not access that object methods/properties.
>>
>>So, you would have to somehow save the "parent" object inside this "child" object (Hugo's idea) , but it may easily lead to dangling references and other bad things.
>
>I didn't see your other post before I read this one. Making more sense, but not sure how I'm going to handle this. This seems like such a simple functionality that I want that I can't believe that it's this difficult to do.

Hi Jay,

I was thinking a bit more on the problem and here is a simple idea.

Since you have oServer which has both objects (oSock and oHandler) saved as their references, you may do from oServer

this.oHandler.Handle(this.oSock.State) && or you may even pass oSock as an object, though I think the first way is preferrable.
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