StrataFrame Forum

MDI Parent not showing form controls for child

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

By Andria Jensen - 7/10/2006

I have some dll's with forms which are shown on a menu click in my MDI Parent form.  I have IsMdiContainer=True on the parent, and IsChildForm=True on the child.  I have MaximizeBox=True and MinimizeBox=True for both parent and child.  When I show the child form everything is fine unless I maximize it.  It maximizes within the parent, but I lose my form controls for minimize, restore, and closing the form.  These should show up somewhere shouldn't they?  I don't have a menu bar on the parent, is this the issue?  And if so, can I get around it?  Right now, I can't maximize forms unless I want them to always be maximized...and also, if I click on the parent Close X and a child form is showing, it will the child form on top instead of closing the entire parent.
By StrataFrame Team - 7/10/2006

You don't want to use the IsChildForm property... that's a StrataFrame property that's used for the ChildFormDialog.  What you want to do is set the MdiParent property on the child form to an instance of the MDI parent form.  Then, when you maximize, you should be able to see both sets of control boxes (minimize, maximize, and close).  I've tested it, and you should still see both sets of control boxes even without a menu.
By Andria Jensen - 7/10/2006

I have the IsChild property setto False now and it didn't make any difference.  I was already setting the MdiParent to the parent form.  The code I'm using is something like the following:

Private Sub ShowTable(ByVal Type As TableType)
 
Dim TableForm As MicroFour.StrataFrame.UI.Windows.Forms.StandardForm|
  
Select Case Type
    ....
    Case TableType.SomeType : TableForm = frmSomeForm.GetInstance
    ....
  End Select

  If TableForm IsNot Nothing Then
    TableForm.MdiParent = Me
   
TableForm.Show()
   
Me.ActivateMdiChild(TableForm)
 
End If

End Sub

 

GetInstance is a method that returns the unique instance of the form, so that only one is shown at a time.  Something like this:

Public Class frmSomeForm

 
Shared UniqueInstance As frmSomeForm
 
 
Shared Function GetInstance() As frmSomeForm
   
If UniqueInstance Is Nothing Then UniqueInstance = New frmSomeForm
   
Return UniqueInstance
 
End Function

End Class

By StrataFrame Team - 7/10/2006

I'm not sure what is happening, then.  I created a new project, set Form1.IsMdiContainer = True, added another form (Form2) and created a new instance of Form2 as a child of Form1 within Form1.Load.  When I maximized Form2, I got the second screen shot.
By StrataFrame Team - 7/10/2006

Oh, and this was the code in Form1:

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim loForm As New Form2()
        loForm.Show()
        loForm.MdiParent =
Me
        Me.ActivateMdiChild(loForm)
    End Sub
End
Class

By StrataFrame Team - 7/10/2006

And I tried it by setting the MdiParent property on Form2 before showing it and got the same results.
By Andria Jensen - 7/10/2006

I am trying to create a small test project, and am now getting an error message which I am attaching.  I created a StrataFrame Windows App, and then when I tried to add an SF DevEx Standard Form as a new item, I get the error message.  Not sure where this is coming from...any ideas?
By Andria Jensen - 7/10/2006

I figured out the problem.  When I add a BarManager object from DevExpress it makes my control box disappear for maximized child forms.  Not sure, but it looks like a DevExpress bug.
By StrataFrame Team - 7/10/2006

Yes, I can see that... the BarManager has it's own set of "rules" that it lives by.  You might be able to set the padding on it, or something like that.