Ranorex

Form.GetControls

 
Post new topic   Reply to topic    Ranorex Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
GuiTester



Joined: 11 Sep 2006
Posts: 4

PostPosted: Fri Sep 15, 2006 10:53 am    Post subject: Form.GetControls
The class Form has a method called GetControls which does not take any parameter and the return value is also void. The help for the method says "Gets an array containing all controls in the form ."

Also, is there a reason why the classes are named same as in the Systems.Windows? If I use System.Windows.Forms.Form and Ranorex.Form in the same program, I need explicitly specify which form I want to use.

And looking at the code: form.<somemethod> there is no way to tell whether it is systems form or Ranorex form. The code looks very messy.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sat Sep 16, 2006 12:35 am    Post subject:
The Form class function GetControls() makes a connection to the automated form, reads all controls and fills the Form property Controls. For speed reasons the function will not called in the constructor of the Form class. The user must call the GetControls() function to read and fill the control array.

Code: click into code to enlarge
form.GetControls();
foreach (Control control in form.Controls)
{
    IntPtr handle = control.Handle;
    Point location = control.Location;
    Size size = control.Size;
    String text = control.Text;
    Console.WriteLine("Handle={0} Location={1} Text={2}", handle, location, text);
}

See also the sample project RanorexVS2005Sample4
I’m sorry for the poor documentation, we will extend it with some samples in the next version.

> Why the classes in RanorexNet have the same names as in System.Windows.Forms?
Normally you make a console application if you write testscripts, so you don't use the System.Windows.Forms namespace.
It's easier to write and understand the automation code if you use the same class names as in the real application.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> Bug Reports All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum