Sign in to follow this  
Followers 0
yevlar

Issue with setting ListView focus / GUI ClickItem

3 posts in this topic

#1 ·  Posted (edited)

Hi - I'm having an issue with setting the focus of a ListView item in a 3rd party GUI (Quicktime, specifically.)

Basically, I have the code set-up to select a listview item, but the selection is never Focused (it's selected grey rather than blue.) I need to have the listview item focused so I can send F2 and text to rename the item.

From what I've read on the forums thusfar, it seems like GUICtrlListView_ClickItem is the most consistent way to set focus of a listview item (I've tried setting focus via both _GUICtrlListView_SetItemSelected and _GUICtrlListView_SetItemFocused to no avail,) but ClickItem is always clicking the window that's behind the current focused window. I'm sure I'm just missing some simple parameter that should tell ClickItem where to correctly click, but every iteration I've tried has failed thusfar.

Could someone take a quick look at the code I'm using and see what I'm missing?

Thanks!

$items = ControlListView("[CLASS:MPGenericPaneClass]", "MPTrackListView", "[CLASS:SysListView32]", "GetItemCount")
if $items = 11 then
$select = ControlListView("[CLASS:MPGenericPaneClass]", "MPTrackListView", "[CLASS:SysListView32]", "Select", 9)
_GUICtrlListView_SetItemSelected($select, 0, True, True)
$sHandle = GUICtrlGetHandle($select)
   sleep(500)
_GUICtrlListView_ClickItem($sHandle, 0, "left", False, 1)
EndIf

UPDATE:

I also tried this, again to no avail:

$items = ControlListView("[CLASS:MPGenericPaneClass]", "MPTrackListView", "[CLASS:SysListView32]", "GetItemCount")
if $items = 11 then
$select = ControlListView("[CLASS:MPGenericPaneClass]", "MPTrackListView", "[CLASS:SysListView32]", "Select", 9)
_GUICtrlListView_SetItemSelected($select, 0, True, True)
;$sHandle = GUICtrlGetHandle($select)
$sPos = _GUICtrlListView_GetItemPosition($select, 0)
   sleep(500)
_GUICtrlListView_ClickItem($sPos, 0, "left", False, 1)
EndIf
Edited by yevlar

Share this post


Link to post
Share on other sites



The _GUICtrlListView_* functions work a little differently to ControlListView(), they require a handle to the listview control itself (not the window) to operate properly on foreign processes...

$hCtrl = ControlGetHandle("[CLASS:MPGenericPaneClass]", "MPTrackListView", "[CLASS:SysListView32]")
_GUICtrlListView_ClickItem($hCtrl, 5, "Left")

 

Share this post


Link to post
Share on other sites

Awesome! It works beautifully! Thank you so much!

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