| View previous topic :: View next topic |
| Author |
Message |
haynitin
Joined: 09 Mar 2007 Posts: 2 Location: India
|
Posted: Sat Mar 10, 2007 10:14 am Post subject: GetControls() returns void pointer. |
|
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. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sat Mar 10, 2007 7:36 pm Post subject: |
|
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: 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);
}
Gabor
Ranorex Team |
|
| Back to top |
|
 |
david_dawkins
Joined: 17 Mar 2007 Posts: 6
|
Posted: Sat Mar 17, 2007 10:59 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sun Mar 18, 2007 4:29 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
|