Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PARENT is not an Object
Message
 
 
To
11/01/1999 11:24:34
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00174673
Message ID:
00174692
Views:
25
George,

The Parent property relates to "containership hierarchy" of the object. It only has a valid object reference if the object has been put into a container class (Form, Container, Custom, Page, etc) This is done by calling the AddObject method of a container, or when dropping objects into a container on the form/class designer.

If you use CreateObject() you are not causing a containership relation between two objects. It's hard to say exactly what type of relationship your two objects have now without seeing the relevant code.

Another thing to consider is the oTwo probably shouldn't be changing a property of oOne directly. oTwo should call a method of oOne requesting it to increment it's counter.

>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?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform