Sign in to follow this  
Followers 0
Geethu

Select an item from treeView using index

3 posts in this topic

Hi,

I just want to select an item from a treeview. I tried the following : 

 $selectedItem = ControlTreeView($wndHandle, "", "[NAME:tree]", "GetText", "#1") ; this for selecting the first item.

Sample tree view is attached with this. Could you please help me?

post-85609-0-98934000-1398180665.png

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try using the below examples.

#include <GuiTreeView.au3>
$hTreeView = ControlGetHandle($GUIhandle, "", "[CLASS:SysTreeView32; INSTANCE:4]") ; The class for tree. Before that get the GUI handle
$hTMP = _GUICtrlTreeView_FindItem($hTreeView, $Treename, True) ; $treename = tree name if the main tree has a name.
If $hTMP Then
        _GUICtrlTreeView_Expand($hTreeView,$hTMP, True)
        Sleep(1000)
        $ret = _GUICtrlTreeView_GetText($hTreeView, $Treename)
Endif
If _GUICtrlTreeView_GetChildren($hTreeView, $hTMP) Then
       $hchild = _GUICtrlTreeView_GetFirstChild($hroot, $hparent)
       while $hchild
            $cText = _GUICtrlTreeView_GetText($hroot, $hchild)
            ;Do whatever you want
            $hchild = _GUICtrlTreeView_GetNextChild($hroot, $hchild)
        WEnd
Endif

Note: This is not a complete code. This is just an example

Edited by hellovivz

Share this post


Link to post
Share on other sites

Hi hellovivz,

Thanks for your reply. Its not working for me, because the treeView is non GUI control. It is a window control. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0