In the above sample tree, let's say i would like to figure out the total number of child objects in the tree inclusive of the leaves and subleaves. How do I do that? Is there an available method in SilkTest? I look GetSubItemCount() but it only goes through one level. Any ideas and suggestions. Thanks!
At present it is a bit tricky. But refer the method below, this helps to expand all the items in a treeview. Maybe this could give you a start. We can overwrite the GetSubItemCount () method on similar basis to expand all children of a specific item and return the contents. Will get back to you.
Hope this helps,
[This message has been edited by witchcrop (edited 07-03-2002).]
Well there is more than one issure here,
1) If you want to know that total number of items in a treeview then the method GetItemCount () is usefull. Here all we have to do is pass the argument to the method as True which will return the total number of items in the treeview irrespective of whether hidden or collapsed.
2) If you want to know the total number of items (children) of a particular item of a treeview, then the method copied below should help you to do so. I hope this method should work for more than 2 levels of tree. Let me know about this.
This method will expand only the members of the item whose children you want to know. And return you the total number of children of the specified item. I have used a sample application there, so use it as it applies to you.
3) If you want to know the total Contents of the treeview then GetContents () should be enough, but if you want to know the enitre contents (including immediate children and therafter) of a particular item, then we will have to create a custom class for treeview and overwrite the GetContents method. Also here as is the case of GetItemCount (), the function returns only the items that are viewable, so we can use the method in conjunction with the one posted earlier (to expand the entire treeview) or the one mentioned above (which only expands a specific item completely).
I hope i was of some help. Keep us posted.
never say die
[This message has been edited by witchcrop (edited 07-04-2002).]