Class library usage, coding and language questions.
Posts: 24
Joined: Fri Nov 03, 2006 5:50 pm


Post by tkondal » Mon Mar 26, 2007 7:26 pm


I am having trouble using the Ranorex.TreeViewSelectItem() function. I keep on getting an argument error in Python. I am passing it two arguments (a handle to my treeview and another handle to my treeview item).

Code: Select all

Ranorex.TreeViewSelectItem(hTreeView, hTreeViewRoot);
According to the docs, that's all that is needed, am I doing something wrong here? (By the way, both arguments are valid handles)


Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Tue Mar 27, 2007 9:30 pm

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 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 :
        if subitem > 0:
            checkItem(treeView, subitem)
        actItem = Ranorex.TreeViewGetNextItem(treeView,actItem)
        if actItem == 0:
        text = Ranorex.TreeViewGetItemText(treeView,actItem)
        print '    text=' + str(text)
        cp = Ranorex.ControlGetPosition(treeView)
        position = Ranorex.TreeViewGetItemPosition(treeView,actItem)
        print '    position=',
        print position
        if position != None:

item = Ranorex.TreeViewGetRootItem(treeView)
text = Ranorex.TreeViewGetItemText(treeView,item)
print '  roottext=' + str(text)
checkItem(treeView, item)
item = Ranorex.TreeViewSelectItem(treeView,'SecondNode - SecondChild')
Ranorex Team