The function TreeViewSelectItem has three arguments, the first one is the handle of the treeview, the second is the name of the item to select and the third one is the handle of the item to start the search from.
The Python documentation is not right, sorry, we will correct it for the next release.
Please see the usage in the sample TreeViewTest.py from the Samples directory.
The following code dumps out all items of the treeview:
Code: Select all
def checkItem(treeView,item):
text = Ranorex.TreeViewGetItemText(treeView,item)
print ' text=' + str(text)
actItem = item
while actItem >= 0 :
subitem=Ranorex.TreeViewGetChildItem(treeView,actItem)
if subitem > 0:
checkItem(treeView, subitem)
actItem = Ranorex.TreeViewGetNextItem(treeView,actItem)
if actItem == 0:
break
text = Ranorex.TreeViewGetItemText(treeView,actItem)
print ' text=' + str(text)
cp = Ranorex.ControlGetPosition(treeView)
Ranorex.TreeViewSelectItem(treeView,text)
position = Ranorex.TreeViewGetItemPosition(treeView,actItem)
print ' position=',
print position
if position != None:
Ranorex.MouseMove(cp[0]+position[0]+(position[2]-position[0])/2,cp[1]+position[1]+10,10)
...
item = Ranorex.TreeViewGetRootItem(treeView)
text = Ranorex.TreeViewGetItemText(treeView,item)
print ' roottext=' + str(text)
checkItem(treeView, item)
...
item = Ranorex.TreeViewSelectItem(treeView,'SecondNode - SecondChild')
...
Jenö
Ranorex Team