Find form by "Control name"

Class library usage, coding and language questions.
david_dawkins
Posts: 6
Joined: Sat Mar 17, 2007 6:50 pm

Find form by "Control name"

Post by david_dawkins » Sat Mar 17, 2007 7:00 pm

Hi,
Amongst other things, RanorexSpy shows me "Class name", "Control name" and "Caption/text". I can see the API in Application to find a form by class name, and by caption text.

However, my application's "Control name" is the key I need to locate its form; how do I do this? It's as if I need Application.FindFormByControlName.

(Caption/text changes too often to be reliable, and the "class name" is junk - anyone know how to set that programmatically?)

Thanks!
DavidD

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sat Mar 17, 2007 7:56 pm

david_dawkins wrote:It's as if I need Application.FindFormByControlName.
Good idea, we will support this function in the next version.

But you can find the form easily in V1.1.0:

Code: Select all

Application.GetForms();
foreach (Form form in Application.Forms)
{
    if (form.Name == "SearchedForm" )
    {
        form.Activate();
        break;
    }
}
Jenö
Ranorex Team

david_dawkins
Posts: 6
Joined: Sat Mar 17, 2007 6:50 pm

Post by david_dawkins » Sat Mar 17, 2007 8:23 pm

Thanks for your reply ; however I have no method Form.Name in the v1.1.0 that I have installed.
Error 1 'Ranorex.Form' does not contain a definition for 'Name' C:\Program Files\Ranorex-1.1.0\Samples\RanorexVS2005Sample1\Class1.cs 131 25 RanorexVS2005Sample1
Intellisense doesn't show it to me, either. The documentation however claims that it should be there.

Thanks
David D

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sun Mar 18, 2007 3:30 pm

The Name and ControlId property are only supported in the professional version.

Sorry for the missing comment "Supported only in RanorexPro" in the documentation.

We will extend the documentation for the next version.

Jenö
Ranorex Team