1. Requirement: select only one specified value in a container control.
2. Capture the target container: assign a value after namemapping
Set detailprodgroups = aliases. dbcproductsdetailcontainer. detailprodgroup
The container layout is as follows (each row includes checkbox, image, textview, label, and so on ):
650) This. width = 650; "Title =" qq 41031153125.png "alt =" wKioL1RTO2HAua8oAAC8rRTJ-dg765.jpg "src =" http://s3.51cto.com/wyfs02/M00/4D/8F/wKioL1RTO2HAua8oAAC8rRTJ-dg765.jpg "/>
3. Implementation idea: only capture the container layer, then obtain the sub-object based on the Child method or the item method (different methods of the control), and then match the sub-object name in the loop.
4. Code pasting:
For i =0 To DetailProdGroups.BandCount-1 ‘get the name of child controls strProductName=DetailProdGroups.Child(i).ComponentTitle ‘set the status of checked all false DetailProdGroups.Child(i).BandCheckbox.Checked=false If productname <>"" Then ‘only select product "productname" If Instr(strProductName,productname)>0 Then DetailProdGroups.Child(i).BandCheckbox.Checked=true End If Else Log.Error("The product name"& productname &" is invalid.") Exit Sub End If Next
This article is from the "qytag (upspringing)" blog, please be sure to keep this source http://qytag.blog.51cto.com/6125308/1570410
Traversal of container neutron objects in testcomplete