Function Reference

_GUICtrlTreeView_GetNext

呼んだアイテムの1つ後ろのアイテムを取得します。

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNext($hWnd, $hItem)

 

パラメータ

$hWnd コントロールのハンドル
$hItem アイテムのハンドル

 

返し値

成功: 1つ後ろのアイテムのハンドル
失敗: 0

 

注意

呼んだアイテムが最後のアイテムだった場合、_GUICtrlTreeView_GetNextは0を返します。
それ以外の場合は非表示アイテム、子アイテムを含む1つ後ろのアイテムを返します。
同じレベルの1つ後ろのアイテムを取得するには_GUICtrlTreeView_GetNextSiblingを使用してアイテムを呼んでください。
表示されている1つ後ろのアイテムを取得するには_GUICtrlTreeView_GetNextVisibleを使用してください。

 

関連

_GUICtrlTreeView_GetNextVisible, _GUICtrlTreeView_GetNextSibling, _GUICtrlTreeView_GetPrev

 


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

Opt('MustDeclareVars', 1)

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

_Main()

Func _Main()

    Local $hItem[10], $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
   
    GUICreate("TreeView Get Next", 400, 300)

    $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To 3
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
        For $y = 1 To Random(2, 10, 1)
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
        Next
    Next
    $hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 5), $hTreeView)
    For $x = 5 To 9
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
        For $y = 1 To Random(2, 10, 1)
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)
   
    MsgBox(4160, "Information", "Index 2, Next: " & _GUICtrlTreeView_GetNext($hTreeView, $hItem[2]))
    _GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNext($hTreeView, $hItem[2]))

    MsgBox(4160, "Information", "Index 4, Next: " & _GUICtrlTreeView_GetNext($hTreeView, $hItem[4]))
    _GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNext($hTreeView, $hItem[4]))

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