Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing a parent's object
Message
From
28/08/2007 07:30:31
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
27/08/2007 12:52:57
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01250681
Message ID:
01250865
Views:
16
>This is simplified, but oSock and oHandler are on the same level under the oxServer class. In oHandler is the Acknoledgement procedure that needs to know the current status of the port, which is in oSock. How do I make that reference? This.Parent doesn't seem to work as the oHandler is created before oxServer.
>
>
>
>oxServer
>   oSock
>      State
>   oHandler
>     Acknowledgement procedure (needs to know value of oSock.State)
>
Objects are not supposed to know anything about the insides of other objects at runtime.

Don't use the init of the objects to do much. Create your own Setup method on oSock and oHandler. Instantiate both oSock and oHandler within oxServer's Init and call their Setup methods. oxServer should have methods to support communication between oSock and oHandler. oxServer should have a method like GetState and GetAcknowledgement. oSock should have a method like GetState and oHandler should have a method like GetAcknowledgement. oHandler.GetState can then do THIS.Parent.GetState().

My telephone handset has a jack for a headset. The jack is like oxServer. It connects the headset to the handset. The blueprints for each contain the details for each AND they show single connection points between each.

Each of these don't know anything about the other except the connection points.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform