Hiya
Im a bit confused as to how you can find child windows of an MDI application.
It seems there is no way to search the child windows of a window and return a Form object... you can only return a Control/Element
Eg.
I want to do the following
- Find the main application window
- Find the MDI Client window
- Find all child windows of the MDI Client
and have each of them as a Form object - how is that possible?
there seems to be no method to search a Form for a child Form, and return a Form object.
Or does Ranorex only consider top level windows as Form objects?
Thanks
Finding Child Windows on an MDI application
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
You can construct a Form instance from any control:
Its methods and properties will only work, however, if the control is really a form.
Regards,
Alex
Ranorex Support Team
Code: Select all
Control mdiControl = form.FindControlId(12345);
Form mdiForm = new Form(mdiControl.Handle);
Regards,
Alex
Ranorex Support Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Just find the MDI windows as you did before (I used the FindControlId method as a sample) and construct the Form instances from the control instances.
Regards,
Alex
Ranorex Support Team
Regards,
Alex
Ranorex Support Team
Last edited by Support Team on Thu Dec 11, 2008 12:27 pm, edited 1 time in total.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
You did manage to find your MDI client windows as Control instances, didn't you? If not, try searching for them using the Control.FindClassName method and specify "MDIClient" as class name.
When you got your MDI client window as a Control instance, you can construct a Form instance from its Control.Handle. You can get its child controls by accessing the Children property. The Control.Text property correpsonds to the caption of the MDI child window.
Regards,
Alex
Ranorex Support Team
When you got your MDI client window as a Control instance, you can construct a Form instance from its Control.Handle. You can get its child controls by accessing the Children property. The Control.Text property correpsonds to the caption of the MDI child window.
Regards,
Alex
Ranorex Support Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Finding Child Windows on an MDI application
Hi Alex,
I tried using FindChild and FindDescendant to find MDI child windows but no luck. If you get a chance could you please send me some sample code on code on finding of MDI child and MDI controls.
That would be very helpful for me if you sending the code ASAP.
I tried using FindChild and FindDescendant to find MDI child windows but no luck. If you get a chance could you please send me some sample code on code on finding of MDI child and MDI controls.
That would be very helpful for me if you sending the code ASAP.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Finding Child Windows on an MDI application
We can't provide you with any code, because we don't know how your application looks like. Please, post a Ranorex snapshot (see http://www.ranorex.com/support/user-gui ... html#c2072) of your application!srini wrote:That would be very helpful for me if you sending the code ASAP.
Basically, you should analyze your application using Ranorex Spy (see http://www.ranorex.com/support/user-gui ... x-spy.html) and check whether Ranorex Spy recognizes the child windows in your MDI application. Then you can use the generated RanoreXPath to find the elements corresponding to your controls.
Please note that although "Tracking" sometimes does not work correctly, Ranorex might still be able to identify the controls. Try to enable "Highlight Elements" from the toolbar and navigate in the element tree in order to find the child controls!
Regards,
Alex
Ranorex Support Team