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
1149
Tabbed Mdi Form will not became active
posted

Hi everybody,

I got stucked with a singular graphic problem. Normally, using UltraTabbedMdiManager, when I add a new child (creating a child form then calling its Show method) this will be shown in a new tab that became active showing the contained child.

Recently I'm developing a little bit complex rich client that require to open a mdi child from a dialog box.
That's possible and almost all works good except for activation of the tab. It opens the new tab but leaves it not selected, I mean the currently selected tab before to open the interesting one, remain the active tab.

Everything else seems to works, in fact I can click the new tab and it will became active and correctly shows its child.

I tried lots of workarounds with no success, manually setting active tab (method Activate), selected tab (property SelectedTab) and so on.

Please can anybody help me find a good workaround?

I'm going to attach a sample to show this odd behavior.
Run the form application, then an automatic child will appear.
Good
Click on the ribbon button "Open child form" and a second child will be loaded, tab will be added and shown.
Good
Now click the ribbon button called "Open Dialog", a dialog will be shown; it's a form with a single button.
Good
Click that button and a third child will be added, but surprise: the tab will remain unselected until you manually click on it.

Any help will be appreciated.
Thank in advance
Gianni

WindowsFormsApplication1.zip
  • 48586
    Verified Answer
    posted

    Hello,

     

    Thank you for the provided sample. As far as I understand  your issue is that the child form that you have added trough your DialogForm, was not activated when dialog was closed.  Sins you display your DialogForm as Dialog, execution of the code of your Form1 stops until you close DialogForm, this allows you to activate the latest added MdiChild form after dialog was closed. For example you could use code like:

     

    this.MdiChildren[this.MdiChildren.Count() - 1].Activate();

     

    On line 39 of your Form1 class, in other words Button2_ToolClick will look like:

     

    void Button2_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)

            {

                new DialogForm().ShowDialog();

                this.MdiChildren[this.MdiChildren.Count() - 1].Activate();

            }

     

     

    Please let me know if you have any further questions.