Ranorex

GetControls() returns void pointer.

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
haynitin



Joined: 09 Mar 2007
Posts: 2
Location: India

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
david_dawkins



Joined: 17 Mar 2007
Posts: 6

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet 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