Ranorex

TreeViewSelectItem

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython
View previous topic :: View next topic  
Author Message
tkondal



Joined: 03 Nov 2006
Posts: 24

PostPosted: Mon Mar 26, 2007 8:26 pm    Post subject: TreeViewSelectItem
Hi,

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: click into code to enlarge
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)

Thanks.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Mar 27, 2007 10:30 pm    Post subject:
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: click into code to enlarge
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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum