Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Blank space at the bottom and no Minimum/MaximumSize when in tabbed view
posted
Hello.
  • I have a form that is Mdi container, and has an UltraTabbedMdiManager. Let’s call it MainForm.
  • MainForm has a Property called Tabbed that activates or deactivates the UltraTabbedMdiManager by changing the value of UltraTabbedMdiManager.MdiParent to this or null.
  • MdiChild (which inherits from Windows.Forms.Form) will be the base class of all the children that will be assigned to MainForm.
  • The implementation of MdiChild should include the assignment of the property MdiParent=MainForm.
 My question is: where is the right place in the MdiChild implementation for assigning the MdiParent property? I tried assigning MdiParent in the constructor, before the InitializeComponent. Then I got this unwanted behaviors:
  • When I create a child having MainForm in Tabbed mode, a blank space appeared at the bottom.
  • When changing back from Tabbed to Normal, all the children created while in Tabbed lost the values of MaximumSize and MinimumSize.
Assinging MdiParent in the constructor, but after the InitializeComponent, results in the same behavior because the children are instances of inheritors of MdiChild, and their own InitializeComponent is being invoked after the base constructor.  

Assigning the MdiParent in the OnLoad of the MdiChild will work, but it will force all the controls in the form to load twice.

Parents
No Data
Reply
  • 44743
    posted

    First off, changing the value of the MdiParent on the UltraTabbedMdiManager from null to the Form or vice versa is not the proper way to toggle between tabbed and non-tabbed layouts.  It is recommended that you instead set the Enabled property of the UltraTabbedMdiManager to True or False. Try changing this first to see if it fixes the issues.

    If using the Enabled property still gives you the same issues, I would recommend trying to set the MdiParent after the entire Form's constructor has completed but before it has had its Handle created (due to a Show call). This would probably be easiest to accomplish from the code creating and showing the MdiChild, but if you must set the MdiParent from within the MdiChild, try overriding OnHandleCreated. In your implementation, set the MdiParent, then call the base implementation. It is after the handle is created, but it is the earliest sync point in the handle creation process and may prevent the loading of the form's controls twice.

Children