Ranorex

Control.FindControlName

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



Joined: 21 Feb 2008
Posts: 9
Location: Ternitz

PostPosted: Wed Apr 23, 2008 10:41 am    Post subject: Control.FindControlName
I've got some curious behavior in an sample - application:
There are 2 controls named the same, RanorexSpyPro cannot find them, I've found them by recursive walkthrough, how can I access them ?

With FindControlName I only get one of them.

Other Find-Versions do not work !
_________________
Everybody here ... comes from somewhere ...
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 344

PostPosted: Wed Apr 23, 2008 1:37 pm    Post subject:
Do those 2 controls have a different parent? Could you post a screenshot including the SpyPro ?

With the spy, try to drag the tracker over the target location to obtain extended properties.

If they do, try to search for the its parent first. Otherwise you can iterate through the Child collection to obtain both.

Michael
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Schuco



Joined: 21 Feb 2008
Posts: 9
Location: Ternitz

PostPosted: Wed Apr 23, 2008 1:53 pm    Post subject: Same parent
They have the same parent, in this case the parent is a RowListEditor, the children both are from class "CellControl" named "CellControl".

I'm not sure how this is possible.

As you can see at the screenshot the string in [] is the control-name.
There you can find "CellControl" twice and "CtlRowEdit" a lot of times.

[img]http://img2.freeimagehosting.net/image.php?2b4ddad14c.jpg[/img]
_________________
Everybody here ... comes from somewhere ...
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 344

PostPosted: Fri Apr 25, 2008 11:48 am    Post subject:
Two controls can have the same control name in Windows Forms, even if they have the same parent.
However, distinct names are usually enforced by the Forms Designer.
It is probably a good idea to use indices instead.

Michael
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Schuco



Joined: 21 Feb 2008
Posts: 9
Location: Ternitz

PostPosted: Mon Apr 28, 2008 11:10 am    Post subject:
Support Team wrote:
Two controls can have the same control name in Windows Forms, even if they have the same parent.
However, distinct names are usually enforced by the Forms Designer.
It is probably a good idea to use indices instead.

Michael
Ranorex Team


OK, I've done it with a loop.
Thanx
_________________
Everybody here ... comes from somewhere ...
Back to top
View user's profile Send private message
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