Ranorex

FindControlName with more instances of a control in a Form

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



Joined: 23 Aug 2007
Posts: 20

PostPosted: Thu Aug 07, 2008 1:16 pm    Post subject: FindControlName with more instances of a control in a Form
scenario: in an MDI-Window, there are more Controls with the same control-name
How can i get a list of these controls ? "FindControlName" returns only the actual focused control.
Manually iterating a list of Form.Controls takes too much time, not practicable

Need it for .Net1.1
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: Fri Aug 08, 2008 1:50 pm    Post subject:
How many documents do you have in the MDI-Window?
And how many controls in one document?

Quote:
Form.Controls takes too much time


Form.Controls works normally quickly, but reading the ControlName can take time. How long does it take to find a control by name only in one document (Form)?

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
jabelshauser



Joined: 23 Aug 2007
Posts: 20

PostPosted: Mon Aug 11, 2008 12:42 pm    Post subject:
about 10s, there were about 80 controls in the Form (all about, i don't remember exactly)
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: Mon Aug 11, 2008 5:10 pm    Post subject:
Quote:
about 10s, there were about 80 controls in the Form


10 sec is too long, can you please post your source code.

Please read also the following thread:

http://www.ranorex.com/forum/why-so-slow-t433.html

Can this be the same problem as yours?

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
jabelshauser



Joined: 23 Aug 2007
Posts: 20

PostPosted: Tue Aug 12, 2008 9:44 am    Post subject:
Enable Caching has no effect.

Here the code:
ArrayList al = _obj.Controls;
Trace.WriteLine("control count = " + al.Count);

foreach(Control ctrl in al)
{
if(ctrl.Name == "frmUiWindow")
Trace.WriteLine(ctrl.Name.ToString());
}
DateTime tstop = DateTime.Now;

Trace.WriteLine("elapsed time = " + (tstop - tstart).ToString());

Trace:
control count = 148
frmUiWindow
frmUiWindow
elapsed time = 00:00:16.6091624
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: Tue Aug 12, 2008 4:57 pm    Post subject:
OK, i think the problem is the SleepTime property.

Here is the documentation of the Application.SleepTime property:

Quote:
Gets or sets the sleep time in milliseconds as an integer value. The current thread will be suspended for the specified sleep time after every command.


You can speed up your scripts with the SleepTime properety.
Please set this property to 0 (Application.SleepTime=0) and try the same code again.

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
jabelshauser



Joined: 23 Aug 2007
Posts: 20

PostPosted: Wed Aug 13, 2008 8:20 am    Post subject:
ok, the speedtime was the problem.
What's the reasons for such a long default sleeptime ?
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: Wed Aug 13, 2008 5:02 pm    Post subject:
Quote:
What's the reasons for such a long default sleeptime ?


The default SleepTime (50msec) is optimal at the beginning or if you want to follow the automation steps. You can use the SpeedTime as a global variable to control the speed of the automation.
(Please see also Mouse.MoveTime)

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