How to use old controls without control name?

Class library usage, coding and language questions.
webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

How to use old controls without control name?

Post by webops » Mon Aug 14, 2006 11:05 pm

Some user asked me per Mail how to find and automate older controls without a control name with RanorexNet.

We will implement overloaded methods to find controls in a form with ControlId and ClassName in the next Version 0.9.3.
In the actual RanorexNet Version (or in older ones) you can do the following:

1. Get the ControlId with RanorexSpy
2. Find the control with form.FindControlId()
3. Check the control type and cast to the desired type

For example, you can check the Hex radio buttom of the calc application (see first sample) as follows:

Code: Select all

Control control = form.FindControlId(306);
if (control is RadioButton)
{
    RadioButton hexRadio = (RadioButton)control;
    Mouse.MoveToControl(hexRadio);
    hexRadio.Checked = true;
}
Jenö Herget
Ranorex Team