Function Reference

_GUICtrlTreeView_GetParentParam

アイテムの親のコントロールID/パラメータを取得します。

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetParentParam($hWnd, $hItem = 0)

 

パラメータ

$hWnd コントロールのハンドル
$hItem アイテムのID/パラメータ

 

返し値

成功: 親コントロールのパラメータ
失敗: False

 

注意

なし。

 

関連

 


#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を設定し、他のコントロールのハンドルを使用

Example_Internal()
Example_External()

Func Example_Internal()

    Local $hItem, $hChild, $hFirst, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
   
    GUICreate("TreeView Get Parent Param", 400, 300)

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

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

    _GUICtrlTreeView_SelectItem($hTreeView, $hChild)
    MsgBox(4160, "Information", "Parent Param/ID: " & _GUICtrlTreeView_GetParentParam($hTreeView, $hChild)) ; same as controlId

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

Func Example_External()

    Local $GUI, $hItem, $hChild, $hFirst, $iParam = 1, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
   
    $GUI = GUICreate("(UDF Created) TreeView Get Parent Param", 400, 300)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To 20
        $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
        _GUICtrlTreeView_SetItemParam($hTreeView, $hItem, $iParam)
        $iParam += 1
        For $y = 0 To 2
            $hChild = _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Item", $y))
            _GUICtrlTreeView_SetItemParam($hTreeView, $hChild, $iParam)
            $iParam += 1
        Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)
   
    _GUICtrlTreeView_SelectItem($hTreeView, $hChild)
    MsgBox(4160, "Information", "Parent Param: " & _GUICtrlTreeView_GetParentParam($hTreeView, $hChild))

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