Sign in to follow this  
Followers 0
Burgs

Trouble automating a TreeView in an application

5 posts in this topic

Hello,

I am trying to manipulate an application that has a "TreeView" list within it. I am using the "_GUICtrlTreeView_FindItem" command to search for the desired "child" branch in the TreeView, and upon finding it then assigning it a handle so as to "double click" that child so as to open/expand it...

$hHandle = ControlGetHandle("History", "", "[CLASS:SysTreeView32; INSTANCE:1]")
$hItemFound = _GUICtrlTreeView_FindItem($hHandle, "APPLES", TRUE)
If $hItemFound Then
MsgBox(4160, "Information", "Item Found:")
$hItem = ControlGetHandle($hItemFound, "", "[CLASS:SysTreeView32; INSTANCE:1]")
_GUICtrlTreeView_ClickItem($hHandle, $hItem, "left", False, 2)
EndIf

The above code does not throw any error and it seems to run OK, however I do not see the "TreeView" within the application expanding on the desired child, or doing anything at all. What am I missing here? I have not tried to manipulate TreeView commands before so if somebody could inform what I am not understanding I would greatly appreciate it...thank you in advance.

Share this post


Link to post
Share on other sites



Hello,

I replaced that "ClickItem" line with:

ControlTreeView("History", $hItemFound, "[CLASS:SysTreeView32; INSTANCE:1]", "Expand", "Heading1")

However it doesn't seem to have made a difference...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

As @AdmiralAlkex said, use _GUICtrlTreeView_Expand instead of _GUICtrlTreeView_ClickItem.

Edit:

Also, you do not need to use ControlGetHandle on $hItemFound. It is already a handle.

Edited by zorphnog

Share this post


Link to post
Share on other sites

Thanks, I added these lines:

_GUICtrlTreeView_Expand($hHandle, 0, False)  ;COLLAPSE ALL
    _GUICtrlTreeView_Expand($hHandle, $hItemFound, True)

It does successfully collapse all of the TreeView items however I still cannot get the desired 'child' to expand...the only thing I have had success with is expanding ALL the TreeView items...?

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