Jump to content
Sign in to follow this  

Scrolling to selected item in a list view?

Recommended Posts


Hello again........... big-minds!

If i'm using this example:


Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work


Func _Main()
Local $hListView

GUICreate("ListView Set Item Selected", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
For $i = 1 to 100
_GUICtrlListView_AddItem($hListView, "Item " & $i)

; Select item 2
_GUICtrlListView_SetItemSelected($hListView, 40)
MsgBox(4160, "Information", "Item 40 Selected: " & _GUICtrlListView_GetItemSelected($hListView, 40))

; Loop until user exits
EndFunc ;==>_Main

is there any way to scroll to the selected item? _GUICtrlListView_Scroll doesn't help so much! :D

Share this post

Link to post
Share on other sites

It sounds more like you want _GUICtrlListView_EnsureVisible(), that function scrolls to a particular item.

That's it thank you :D

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.