Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PARENT is not an Object
Message
De
11/01/1999 12:11:37
 
 
À
11/01/1999 11:24:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00174673
Message ID:
00174690
Vues:
23
Parent works only for container/object relationship. To access the calling object properties, you need to pass the object reference to the child object.

Ex.:
Parent:
loChild = CreateObject("ChildClass", THIS)

Child.Init()
LPARAMETERS toParent
THIS.oParent = toParent

Child.SomeMethod():
THIS.oParent.Counter = THIS.oParent.Counter + 1

HTH

>I am new to VFP OO coding & am having problems with one object modifying the properties of its parent.
>
>ex.
>oOne is created from a nonvisual class (OBJECT1), it creates an instance of OBJECT2 (oTWO), another class defined in the same prg file.
>
>Part of oTWO's job is to update a counter in oOne, so I include the following code in one of OJECT2's methods:
>
>THIS.PARENT.counter = THIS.PARENT.counter + 1
>
>When it executes I get the error message that THIS.PARENT is not an object & the debugger confirms this, parent = (none)
>
>I don't understand this at all. How could an oject created by another NOT have a parent value filled in?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform