Jump to content

_GUICtrlListView_


pgv
 Share

Recommended Posts

Hi Team

I would like to set focus to a particular item with in the SysListView32. With the help of one of our experts in the forum I am able to get the list and compare the Item with in the SysListView32, but I am unable to set my focus on the desired item

I am using the following code

$hListView = ControlGetHandle($wText, "", "[CLASS:SysListView32; INSTANCE:1]")

If @error = 1 Then

MsgBox(1, "", "Not Found")

Exit

Else

$itemCount = _GUICtrlListView_GetItemCount($hListView)

For $i = 0 To $itemCount - 1

$itemText = _GUICtrlListView_GetItemTextArray($hListView, $i)

sleep(200)

MsgBox(1, "", _ArrayToString($itemText, "",1,1))

$p=_ArrayToString($itemText, "",1,1)

$q="Domain\Administrator"

if $q == $p Then

msgbox(1, "Found", $p)

;$t=_GUICtrlListView_GetItemFocused($p,1)

;$t=_GUICtrlListView_setItemFocused($p,1)

$t=_GUICtrlListView_setItemFocused($hListView,1,$q=true) {This returns the value True but the focus does not move}

msgbox(1,"",$t)

Sleep(3000)

EndIf

Next

EndIf

Appreciate your help on thishttp://www.autoitscript.com/forum/style_images/autoit/folder_post_icons/icon1.gif

Link to comment
Share on other sites

Because the second parameter which should be the item index is always 1....and $q is never true?

$t=_GUICtrlListView_setItemFocused($hListView,1,$q=true)

Try changing it to this:

$t=_GUICtrlListView_setItemFocused($hListView,$i,true)
Link to comment
Share on other sites

Thanks for the reply, the value returns true now, but the item does not get the focus. If you can have a look at my screen shoot, "BD\PGV is has the focus and in blue, this is what I want to achieve.

Appreciate your help on this

Regards

pgv

Because the second parameter which should be the item index is always 1....and $q is never true?

$t=_GUICtrlListView_setItemFocused($hListView,1,$q=true)

Try changing it to this:

$t=_GUICtrlListView_setItemFocused($hListView,$i,true)

post-48074-1239719614_thumb.jpg

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...