I have a composit application, not CAB, and I add forms as MdiChildren and they show up and behave as expected with the TabbedMdiManager at runtime. However, I am also writing extensive unit / interaction tests on my UI and I have run into a snag.
In my test code:
_applicationShell = new ApplicationShell(); StubPresenter presenter1 = new StubPresenter("One"); StubPresenter presenter2 = new StubPresenter("Two"); StubPresenter presenter3 = new StubPresenter("Three"); MdiTabs tabs = new MdiTabs(_applicationShell); tabs.OpenScreen(presenter1); tabs.OpenScreen(presenter2); tabs.OpenScreen(presenter3); Assert.AreEqual(presenter3.View, tabs.SelectedControl); tabs.ActivateSubject(presenter2.Subject); Assert.AreSame(presenter2.View, tabs.SelectedControl);
After tabs.OpenScreen(...) is called, the MdiParent (_applicationShell) has 3 MdiChildren, however the UltraTabbedMdiManager has 0 tab groups and no tabs.
The form never actually displays during this test, but that shouldn't affect the functionallity of the tabbedmdimanager should it? I am I just missing something obvious here?
I managed to get the screens to show up in the tests, I had to show the window containing the TabbedMdiManager. My next problem is that I have a class that is derived from MdiTab that holds a little bit of extra information pertaining to each view. Is there a way that I can retrieve the "ActiveTab" as an instance of my derived type? Casting and safe castin both fail. So I am open to suggestions.
I assume you are using a derived UltraTabbedMdiManager and you override CreateMdiTab to provide your custom tabs? If so, you should be able to cast your tabs. Put a break point in your CreateMdiTab override and make sure it is getting called.