Sign in to follow this  
Followers 0
Picasso51

Selecting a tree Item

1 post in this topic

I have a WPF application with a  treeview control that contains an item (stringXYZ) in several/different branches; however, the second instance is the one I am looking for.  The following code finds it for me.

 $searchText = "StringXYZ"

$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)

 $J=0 ;

  While $hItemFound

   if $J < 2 THEN ;find the second instance of StringXYZ

    _GUICtrlTreeView_SelectItem($hWnd, $hItemFound)

$next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound)

$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next)

;Sleep(1000)

$J=$J+1

Else

   ;found the string

     ExitLoop

 EndIf

Wend

Now that I found it, I need to select it even though it appears to be already selected by the slightly gray background.  Also the function  

   _GUICtrlTreeView_SelectItem($hWnd, $hItemFound) returns TRUE meaning it is selected

However, when I manually click on the stringXYZ, I can clearly see that it is selected for sure (Darker blue background).

The application does not take any shortcuts, tabs or any keyboard combination until I manually click on the stringXYZ item.  I cannot find any key combination that allows me to select it

So I am struggling to find the way to automate.

The mouseclick(“left”)-does not work

Send (“{TAB}”)-does not work

May be the only way is to call it by its handler but problem is the handle changes every time the application is restarted.

Any suggestions is greatly appreciated.

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