MDI Child

Feb 28, 2008 at 6:23 PM
How do I get reference to an MDI child in the framework?

thanx

tim
Feb 29, 2008 at 1:46 AM
This is what I came up with, don't know if this is the best way?

AutomationElementFinder f = new Core.AutomationElementSearch.AutomationElementFinder(this.Window.AutomationElement);

System.Windows.Automation.AutomationElement e = f.Descendant(Core.UIItems.Finders.SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Pane)).FindFirst(System.Windows.Automation.TreeScope.Descendants, System.Windows.Automation.Condition.TrueCondition) ;

return new Win32Window(
e
, Core.Factory.WindowFactory.Desktop
, InitializeOption.NoCache
, this.Application.ApplicationSession.WindowSession(InitializeOption.NoCache));
Coordinator
Mar 22, 2008 at 6:08 PM
Sorry for really late response.
What you are doing is alright. I have marked this as a bug and would be fixing it in next release.
Oct 27, 2008 at 6:09 PM
I was having trouble getting the Window objects that were inside an WinForms MDI Pane so I will post here how I solve the problem in case anybody needs it.
The solution is based on HoundDog's reply. So here it goes:

            AutomationElementFinder f = new AutomationElementFinder(mdiPanel.AutomationElement);
            WindowFactory fact = new WindowFactory(f);
            List<Window> windows = fact.DesktopWindows();

Easy isn't it? mdiPanel is the MDI Pane. I have a problem though getting the MDI Pane. As I told in another post I'm doing a GUI Ripper so I won't have any knowledge of the application.
So how do I check if there is any MDI Pane on the AUT? the way I'm doing is doing:

            mdiPanel = mainWindow.MdiChild(SearchCriteria.ByControlType(ControlType.Pane));

and checking if mdiPanel is null. Can I do this? Will white return null if there isn't any MDIChild? and why is mainWindow titlebar returned if I use SearchCriteria.All?

Thanks,
José Tavares