Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defining parent object programmatically
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00696552
Message ID:
00698104
Views:
17
>Hi Paul,
>
>Does it mean that I don't need to make any changes with my current parent-children bus object relationship? It is because I defined their relationship through the biz object Builder window.
>
>What I need to add is calling SetPrimaryBizObj and RegisterChildBizObj to set a new parent business object? If I want to set the parent biz object back to the original, I will call these two methods again. Is my understanding right?
>
>Thanks a lot again,
>
>Nerissa

I wouldn't use the builder to define the relationships. I would programmatically set them. In addition to adding a child, you will need the UnregisterChildBizObj() or UnregisterAllChildren(), if your child relationships change with the new primary bizobj. For example, you have a form with three bizobjs. At runtime, oSampleBizObj was set as the primary, and oChildBizObj was set as a child of it. oAnotherSampleBizObj is just on the form and isn't directly related to either of the other two.

oSampleBizObj (Primary)
-> oChildBizObj (Child)

oAnotherSampleBizObj (not Primary or Child)

If oAnotherSampleBizObj needed to become the primary bizobj, and oChildBizObj needed to become the child of it (instead of oSampleBizObj), your code might look like:
* Unregister the children first...
ThisForm.oBizObj.UnregisterAllChildren()

* Make oAnotherSampleBizObj the primary, and assign it's children
ThisForm.SetPrimaryBizObj(ThisForm.oAnotherSampleBizObj)
ThisForm.oBizObj.RegisterChildBizObj(ThisForm.oChildBizObj)
HTH
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform