Ensures that a list-view item is either entirely or partially visible
#Include <GuiListView.au3>
_GUICtrlListViewEnsureVisible($h_listview, $i_index, $i_bool)
Parameters
$h_listview | control id/control hWnd |
$i_index | Index of the list-view item |
$i_bool | Value specifying whether the item must be entirely visible |
Return Value
Returns TRUE if successful, or FALSE otherwise
Remarks
If $i_bool parameter is TRUE, no scrolling occurs if the item is at least partially visible
Related
None.
Example
#include <GuiConstants.au3>
#include <GuiListView.au3>
Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $i, $Styles, $Btn_visible, $i
GUICreate("ListView Ensure Visible", 392, 322)
$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 144)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
For $i = 1 To 20
GUICtrlCreateListViewItem("line" & $i & "|data" & $i & "|more" & $i, $listview)
Next
$Btn_visible = GUICtrlCreateButton("Set Visible", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_visible
_GUICtrlListViewEnsureVisible($listview, 12, 1)
EndSelect
WEnd
Exit