Function Reference

_GUICtrlListBox_SelItemRangeEx

複数選択できるリストボックス内の1つ以上の連続的な並びのアイテムを選択します。

#Include <GuiListBox.au3>
_GUICtrlListBox_SelItemRangeEx($hWnd, $iFirst, $iLast)

 

パラメータ

$hWnd コントロールのハンドル
$iFirst 最初の選択アイテムのゼロ始まりのインデックス
$iLast 最後の選択アイテムのゼロ始まりのインデックス

 

返し値

成功: True
失敗: False

 

注意

$iFirstが$iLastよりも小さい場合、指定された範囲のアイテムが選択されます。
$iFirstが$iLastよりも大きいか等しい場合、その範囲のアイテムの選択が解除されます。
アイテムを1つだけ選択するには、2つのアイテムを選択しその後必要ないものの選択を解除してください。

この関数は複数選択できるリストボックスにのみ使用できます。
この関数では65,536アイテムまでの範囲で選択が可能です。

 

関連

_GUICtrlListBox_SelItemRange

 


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; ListBox関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用

_Main()

Func _Main()
    Local $sText, $hListBox

    ; GUIを作成
    GUICreate("List Box Sel Item RangeEx", 400, 296)
    $hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    GUISetState()

    ; 文字列を追加
    _GUICtrlListBox_BeginUpdate($hListBox)
    For $iI = 1 To 10
        $sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
        For $iX = 1 To Random(1, 20, 1)
            $sText &= Chr(Random(65, 90, 1))
        Next
        _GUICtrlListBox_AddString($hListBox, $sText)
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

    ; いくつかアイテムを選択
    _GUICtrlListBox_SelItemRangeEx($hListBox, 3, 5)

    ; ユーザーが終了するまでループ
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main