GetControls() returns void pointer.

Class library usage, coding and language questions.
haynitin
Posts: 2
Joined: Fri Mar 09, 2007 4:21 am
Location: India

GetControls() returns void pointer.

Post by haynitin » Sat Mar 10, 2007 9:14 am

As per the description in chm file for the Form.GetControls()...
"Gets an array containing all controls in the form . ". However the declaration returns a void.

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Sat Mar 10, 2007 6:36 pm

The function GetControls() makes a connection to the automated form, reads all controls and fills the Form property Controls. For speed reasons (the testapplication runs in an other process space) the function will not called in the constructor of the Form class.
Call the GetControls() function to read and fill the control array.

See also the sample project RanorexVS2005Sample4

Code: Select all

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); 
} 
Gabor
Ranorex Team

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

Post by david_dawkins » Sat Mar 17, 2007 9:59 pm

May I suggest that you rename this method "PopulateControls"?

I made the same mistake in thinking the method was prototyped incorrectly.

I also noticed that Element.GetChildCount is a property, and so conventionally ought to be named "Element.ChildCount".

I'm not beating you guys up, I like this product!

Best regards
David D

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Sun Mar 18, 2007 3:29 pm

Yes you are right, i also unhappy with these functions and properties.
We also discussed this topic and decided to be compatible in V1.1.0 and V1.2.0 with every previous versions.
(Every Ranorex version is compatible with every previous one at the moment)

But we will add new functions and properties in the future and eliminate some old ones.
david_dawkins wrote:May I suggest that you rename this method "PopulateControls"?
Good idea, "PopulateControls" would be a better name, we will consider about it.

Jenö
Ranorex Team