Forum Discussion
tristaanogre, Thank you for the information.
It's a simple traverse through a list, but they are not of the same datatypes and the relation between parent and child is not through any unique property.
I am using a property of TestComplete "Find Child" but I require a method to verify if the Child is the item of the parent. Without pointers how to traverse through any list?
FindChild is a method, not a property. You call it from the parent object like so:
parentObject.FindChild(['className','Caption'],['newGrid','My Table'], 2)
The above command will look for any child objects of parentObject that have a className of newGrid and a caption of 'My Table'. It will look down to three levels... the immediate child, the grandchildren, and the great-grandchildren of parentObject. It will find the first match and return it. If it does not find a match, it returns an object with only the Exists property set to False. If you want it to search only immediate children, set the third parameter to a zero. That should give you exactly the child object of parentObject. So... no need to traverse any list.
However, if you want to bring back a list of all matching objects to search for a particular one, change the code to
parentObject.FindAllChildren(['className','Caption'],['newGrid','My Table'], 1)
This will return a safe array of all matching children. To traverse that array, call the "toArray" method of the object and then use standard array traversing using a for loop from 0 to the length of the array.
So.... no pointers necessary.