I am very much interested to include the recursive technique. It is simplifying the code and reduce the number of lines. You can get the definition on Wiki. Below I have given the sample 4test code. This code snippet will get child objects from the given container object.
[+] public LIST OF WINDOW GetChildObjects(Window wContainer, DATACLASS dcObject)
// To get All child objects.
// Used recursive method.
LIST OF WINDOW lwndObjects, lwTemp1, lwTemp2
LIST OF WINDOW lwndChildren = {...}
WINDOW wParent, wChild, wTemp
[+] do
[+] if (wContainer.Exists (10))
lwndChildren = wContainer.GetChildren (TRUE, FALSE)
[+] for each wChild in lwndChildren
[+] if wChild.IsOfClass(dcObject)
ListAppend (lwndObjects,wChild)
[+] else
lwTemp1 = wChild.GetChildren(TRUE, FALSE)
[+] if (ListCount(lwTemp1) > 1)
lwTemp2 = GetChildObjects(wChild,dcObject) //To get particular objects
[+] if (ListCount(lwTemp2) > 0)
ListMerge (lwndObjects, lwTemp2)
[+] else
Print ("Container {[STRING]wContainer} window is not available.")
[+] except
ExceptLog ()
return lwndChildren
No comments:
Post a Comment