Function Reference

_GUICtrlTreeView_Expand

指定された親アイテムに関連付けられた子アイテムリストが存在する場合、開閉します。

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Expand($hWnd[, $hItem = 0[, $fExpand = True]])

 

パラメータ

$hWnd コントロールのハンドル
$hItem [オプション]アイテムのハンドル
$fExpand [オプション]開閉の指定。次の値を使用します:
 True - アイテムを開きます
False - アイテムを閉じます

 

返し値

なし。

 

注意

なし。

 

関連

_GUICtrlTreeView_ExpandedOnce, _GUICtrlTreeView_GetExpanded

 


#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[5], $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
   
    GUICreate("TreeView Expand", 400, 300)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To 4
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

    MsgBox(4160, "Information", "Expand All")
    _GUICtrlTreeView_Expand($hTreeView)
   
    MsgBox(4160, "Information", "Collapse All")
    _GUICtrlTreeView_Expand($hTreeView, 0, False)
   
    MsgBox(4160, "Information", "Expand item 0")
    _GUICtrlTreeView_Expand($hTreeView, $hItem[0])

    MsgBox(4160, "Information", "Collapse item 0")
    _GUICtrlTreeView_Expand($hTreeView, $hItem[0], False)

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