Function Reference

_GUICtrlListSelItemRange

Select range by index in a multiple-selection list box

#Include <GuiList.au3>
_GUICtrlListSelItemRange($h_listbox, $i_flag, $i_start, $i_stop)

 

Parameters

$h_listbox control id/control hWnd
$i_flag Set/Remove select
$i_start Zero-based index of the first item to select
$i_stop Zero-based index of the last item to select

 

Return Value

If an error occurs, the return value is $LB_ERR

 

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES
Select items from $i_start to $stop indices (inclusive)
Can select a range only within the first 65,536 items
$i_flag == 1 selects
$i_flag == 0 removes select

 

Related

_GUICtrlListSelItemRangeEx

 

Example


#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button,$i_sel=1

GUICreate("ListBox Set Item Range Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set/UnSet Items 1 - 5",150,160,120,40)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListSelItemRange($listbox,$i_sel,1,5)
            If($ret == $LB_ERR) Then
                MsgBox(16,"Error","Unknown error from _GUICtrlListSelItemRange")
            EndIf
            $i_sel = Not $i_sel
    EndSelect
Wend