StrataFrame Forum

ParentForm and ParentContainer

http://forum.strataframe.net/Topic15314.aspx

By Ertan Deniz - 4/2/2008

I want to use ParentForm property for the businessObjects that is initiated in the code (i.e not dropped on the form) 

Currently, This type of objects has null value for the property. I've seen the other constructor (with parameter Icontainer) was working. But I couldn't understand When these properties were set. I may follow the same way.

How can I achieve this ?

By Trent L. Taylor - 4/2/2008

We set this property in the actual Get of the ParentForm property itself.  I really don't understand what you are trying to accomplish here so I am not sure how to respond to this post.  Are you just wanting to know how we implement the ParentForm property so that you can emulate this on a control of your own?  If so, then just open up the source code and you can see what we are doing. 

If you are trying to use OUR ParentForm property and just wanting to set it in code, you will not really be able to do this since the logic is within the ParentForm property itself.  This is a readonly property that is self aware and if it has not been set it attempts to look at the ParentContainer for a class of the BaseForm type until it finds one (or doesn't find one).

You may be better off using the ParentContainer property since it can be set in code and it will accept any object that implements the IContainerControl interface.

By Ertan Deniz - 4/2/2008


I'm trying to get some business object usage information like Which forms use which objects for logging purposes.
If I know the parent object (especially the form), it will be logged with necesseary related information. After some time,
I will expect nearly to get some useful information for dependencies between forms and objects.
By Trent L. Taylor - 4/3/2008

One thing you may want to use is the BusinessObjects property on the form.  The form has a collection of BOs on it that are dropped on that particular form, so you may want to try that.  But you will not be able to set the ParentForm property...this is a readonly property that sets itself.  You could look into the ParentContainer property, as mentioned in the previous post, as well.