Jump to content
Sign in to follow this  

Focus Getting lost!

Recommended Posts


I would like to explain whats happening

the Treeview is a list of pcs

the Listview is the same but with different data for organization sake.

What I try to do is if I Click my mouse on a pc in the treeview side it finds the device on the Listview side

then when I'm on the listview side I click on a different pc and it finds it on the listview side.

The problem is when I go back angain to the treeview i have to click twice and sometimes lots more to get focus back on the one I clicked on.????

Hopefully it's somethign simple someone can pickup on.

Case _IsPressed(01), _GUICtrlTreeView_GetFocused($TreeView1, _GUICtrlTreeView_GetSelection(_GUICtrlTreeView_GetText($TreeView1, 0)))

                    $Selected = _GUICtrlTreeView_GetSelection($TreeView1)
                    $pc = _GUICtrlTreeView_GetText($TreeView1, $Selected)
                    $hItemFound2 = _GUICtrlListView_FindText($Listview, $pc, 0, False, True)

                    If $hItemFound2 <> -1 Then
                        _GUICtrlListView_SetItemSelected($Listview, $hItemFound2, True, False)
                        _GUICtrlListView_EnsureVisible($Listview, $hItemFound2, False)

                Case _IsPressed(01), _GUICtrlListView_GetItemFocused($Listview, Int(_GUICtrlListView_GetSelectedIndices($Listview)))

                    $Selected = _GUICtrlListView_GetSelectedIndices($Listview)
                    $pc = _GUICtrlListView_GetItemText($Listview, Int($Selected), 0)

                    $hItemFound = _GUICtrlTreeView_FindItem($TreeView1, $pc, True, 0)

                    If $hItemFound <> -1 Then

                        _GUICtrlTreeView_SelectItem($TreeView1, $hItemFound)
                        _GUICtrlTreeView_EnsureVisible($TreeView1, $hItemFound)
                        _GUICtrlListView_SetItemFocused($TreeView1, $hItemFound, True)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.