Using AppScreen to populate Nested controls. Please Help

Sep 11, 2010 at 4:35 AM


I have started using white recently and i really like it. It is very flexible and easy to use for the most part. I have a problem though. I am using Repository.AppScreen class to populate my classes with UIItems. Now the problem is one windows form has a Pane control and it contains buttons, textboxes and other control. when i use AppScreen i am not able to populate the class with the nested controls that are inside the Pane. Can anyone please help me with this? really appreciate your help.


Sep 11, 2010 at 12:43 PM

are you getting any error or have you checked the name of the field etc.

Sep 12, 2010 at 12:04 AM

No, I don't get any error. I can access the Pane control just fine using the [Text("pane"] attribute, all the other controls are inside that "Pane" control. In the constructor of my class i tried populating other fields from the "Pane" control. but if i declare any other field in that class. I get an error saying that "control with the field name abc not found". So what's the solution to such scenario. let me state it again to make it clear.

Can you please help me how to solve this?  Thanks

Class AbcScreen : AppScreen


    public AbcScreen(Window window, ScreenRepository screen)


        //Here i would like to get the username Textbox either from PropertyGrid or using window.Get<TextBox>("username") but the problem is that the username Textbox is inside the Pane





     public PropertyGrid pg;


     public TextBox username;






Sep 12, 2010 at 5:15 PM

Do you intend to use the Repository features in white or just Core? The reason I am asking, is that you need to define attribute on top of your fields if you want to use Repository.

Sep 13, 2010 at 1:42 AM

Yes, i intend to use the Repository features in White. But I don't know what kind of attribute should i use for the nested controls becuz they are inside a container which is a pane in my case.  so let's say i have this structure

 -Pane --> Text Box, Button

if i use [Text("Pane")] that would give me access to Pane but how should i access the textbox and button inside it?



Sep 18, 2010 at 5:03 PM

white searches all controls irrespective of their position in tree. in other words its always a descendant search instead of child.

If you download which source code you can see some examples of this, in the test code.

Sep 20, 2010 at 3:13 PM

What if these controls are children or nested inside a custom control? Will white still find them?  In my case it doesn't seem to find it when a standard control is inside a custom control



Sep 20, 2010 at 3:33 PM


for Custom controls you have to implement a special class:







Sep 20, 2010 at 5:08 PM




What we are talking about is that the way White searches for controls. What Vivek said was that White searches for control irrespective of where they are (children, sub children, descendent etc).

My question was if we have something like this


           -Text  "a"


                     -Text "b"


if i do Label b = window.get<Label>("b");    Would that return me the b label inside the Custom Control? According to Vivek Yes (if i understood correctly). But when i try it here it doesn't work.

Sep 20, 2010 at 6:04 PM





sorry  my fault :(


ok than I should say you understand right  You should  find  Text "b"


Reason:  UIAutomation would also find the control.


So it is a problem in White





AutomationElement element = window.GetElement(SearchCriteria.By....);

Label label = new Label(element, window.ActionListener);







Sep 20, 2010 at 8:09 PM

Yep That works. Thanks