Child Form Dialog


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I have an contacts user control that I use throughout my application to enter contact information phone numbers etc.

It works nice drop it and a BO on a form set a few properties and I'm done. Because some forms don't have as much real estate as others I added the ability to be able to hide fields on the user control which works out nice, however now I wanted to allow the user to pop up a maintenence form that has all the extra info that may not be shown in that instance of the usercontrol.

Problem is when I try to use the child form dialog control on the usercontrol it squacks about not being on a something inherited from SF base form, (the usercontrol is ultimatley inherited from MicroFour.StrataFrame.UI.Windows.Forms.UserControl with 1 layer of inheritance)

I ignore that messagebox and configure the childcontrol anyway's but get object not set to an instance when I call the showdialog method.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Even child forms should be inherited from a form that has a root of the BaseForm.  This form has all of the logic which know how to properly interact with the BOs.  Just change your form inheritance to MicroFour.StrataFrame.UI.Windows.Forms.StandardForm and your problem will go away.  You may, howveer, need to re-drop your control in order to establish the Synchorization (or ParentControl) property.
Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent,

Maybe I confused you. I have a form say customer. I have a user control for contacts. I drop the user control on the customer form and configure it everything works fine. From the user control I want to launch a child form. I drop a Child Form Dialog control on the user control which inherits from MicroFour.StrataFrame.UI.Windows.Forms.UserControl and I the get the following error message

So it is not possible to use the child form dialog control from a user control?

 


Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Here is part of the stack

MicroFour.StrataFrame.UI.Windows.Forms.ChildFormDialog.GetBusinessObject(BaseForm ParentControl, String BusinessObjectName)

at MicroFour.StrataFrame.UI.Windows.Forms.ChildFormDialog.CreateForm(Object[] Arguments)

at MicroFour.StrataFrame.UI.Windows.Forms.ChildFormDialog.ShowDialog(Object[] Arguments)

at MicroFour.StrataFrame.UI.Windows.Forms.ChildFormDialog.ShowDialog()

Evidently it needs the base form so I think will add a childformdialog property to the user control and have to add and configure a childformdialog control on the main form rather than the user control. or raise an event in the usercontrol when the button is clicked that is handled in the main form. anyways that should work but if not you will be the first to know

Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent,

I can make what I need to make work-work but it kinda sucks as my goal was to have the childdialog configured in the UserControl once instead of having to configure the ChildDialog in every parent form the user control is in.

Is there any way you can think of around this?

Thanks

Paul

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You could configure it programmatically... the UserControl implements the IParentFormLoading interface, which has the ParentFormLoading event.  Handle that event and put the necessary code in the handler to initialize the ChildFormDialog.  You'll probably want to define the ChildFormDialog itself as a private variable on the UserControl rather than dropping it on the form.
Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Thanks Ben,

Thats exactly what I needed. I am still having a problem with the translation item not finding the bus obj but I'll look at it in the morning, You guys have me spoiled with all the Drag and Drop stuff I forget that you can actually use them programtically. 

Anyways Thanks again   

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If it cannot find the BOs then you might need to set the ParentForm property on the ChildFormDialog.  Also, you can drop a ChildFormDialog on the form and configure it the way it needs to be configured and then open the Form.designer.vb file and copy the code that was generated for the ChildFormDialog & paste it into your UserControl.
Paul Chase
Paul Chase
Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Thanks Ben the problem was I was setting the source BO to be the BO on the user control (which made sense to me) but it needed to be the BO on the main form so i just am grabbing it fromthe user controls translations.

Incorrect

ChildDialogTranslationItem.SourceBusinessObject = "WhateverUserControl.BusinesObject"

Correct

ChildDialogTranslationItem.SourceBusinessObject = Me.BOTranslations(0).SourceBusinessObject

 

P


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search