Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design Classes - Iterator-Visitor
Message
From
05/10/1998 07:53:28
 
 
To
05/10/1998 07:35:39
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00143802
Message ID:
00143810
Views:
25
>Ed,
>
>That was my original idea, I was just wondering if there was a way that didn't expose as much of my form workings to the iterator.

You could create an object in the parent, give it references to the parent creator, and have it expose a set of properties. Pass that object to the child. When those properties are updated in the passed object, update the equivalent properties in the parent (easy in VFP 6 using _Assign and _Access methods, or update from the object's Destroy method if the changes do not need to be made until both the child and parent are finished.) You'd subclass this interface object for each parent class that used it. the child then gets a uniform interface regardless of the parent's property - it always gets passed an interface object rather than a parent reference.

Unless you expect to use the child form from lots of different places, with parents that do not have identical public property sets that the child interacts with, or you want to add rules to moderate the interaction with the parent's public property set, it seems to add an unnecessary layer to the interface between parent and child.

>
>Thanks
>
>Rex
>
>>>All,
>>>
>>>I need to return values from a visitor object to my form, but I want to maintain loose coupling between to objects. Is there a slick way to accomplish this? I am considering form properties, but that promotes tight coupling.
>>
>>What about passing a ref to the parent as a parameter, and then manipulating the properties of the parent object from the passed parameter? IOW:
>>
>>loMyChild = CREATEOBJ('ChildObj',this)
>>
>>or
>>
>>DO FORM MyChildForm WITH this
>>
>>and then create a property in the child object to hold the object ref, and assign it in the child's Init() method. Assuming you've defined a property ioParentRef in the child, add this to the Init method code:
>>
>>
>>LPARAMETER toParentObject
>>IF TYPE('toParentObject') = 'O'
>> this.ioParentRef = toParentObject
>>ELSE
>> RETURN .F.
>>ENDIF
>>
>>
>>You can then access Public properties and methods of the parent within the child via this.ioParentRef. Just remember to release the reference this.ioParentRef in your Release() or Destroy() method of the child.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform