kryiran 发表于 2008-8-24 03:08:55

TreeView中_GetParentParam实现问题 什么回事?

#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>

$Form1 = GUICreate("Form1", 145, 454, 193, 115)
$TreeView1 = GUICtrlCreateTreeView(24, 24, 97, 345, -1, $WS_EX_CLIENTEDGE)
$TreeView1_0 = GUICtrlCreateTreeViewItem("TTTT", $TreeView1)
$TreeView2_0 = GUICtrlCreateTreeViewItem("1111", $TreeView1_0)
$TreeView2_1 = GUICtrlCreateTreeViewItem("2222", $TreeView1_0)
$TreeView2_2 = GUICtrlCreateTreeViewItem("3333", $TreeView1_0)
$TreeView2_3 = GUICtrlCreateTreeViewItem("4444", $TreeView1_0)
$TreeView2_4 = GUICtrlCreateTreeViewItem("5555", $TreeView1_0)
$TreeView2_0 = GUICtrlCreateTreeViewItem("TTTT", $TreeView1)
$TreeView3_0 = GUICtrlCreateTreeViewItem("1111", $TreeView2_0)
$TreeView3_1 = GUICtrlCreateTreeViewItem("2222", $TreeView2_0)
$TreeView3_2 = GUICtrlCreateTreeViewItem("3333", $TreeView2_0)
$TreeView3_3 = GUICtrlCreateTreeViewItem("4444", $TreeView2_0)
$TreeView3_4 = GUICtrlCreateTreeViewItem("5555", $TreeView2_0)
GuiCtrlSetState($TreeView1_0, $GUI_EXPAND)
GuiCtrlSetState($TreeView2_0, $GUI_EXPAND)
GUISetState(@SW_SHOW)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $GUI_EVENT_PRIMARYDOWN
                $pos = GUIGetCursorInfo()
                If $pos <> 0 Then
                If ($pos == $TreeView1) Then
                _idgameschakan($TreeView1)
                EndIf
                EndIf
        EndSwitch
WEnd

Func _idgameschakan($TreeView1)
If _GUICtrlTreeView_GetText($TreeView1,(_GUICtrlTreeView_GetSelection($TreeView1))) = "" Then
Else
$aaa = _GUICtrlTreeView_GetText($TreeView1,(_GUICtrlTreeView_GetSelection($TreeView1)))

$fuxiangmu = _GUICtrlTreeView_GetParentParam($TreeView1, $aaa)

MsgBox(0,"",$fuxiangmu)
EndIf
EndFunc
$fuxiangmu 为什么得到的是False??大家帮我看一下

[ 本帖最后由 kryiran 于 2008-8-25 00:04 编辑 ]

kryiran 发表于 2008-8-24 14:08:30

难道真的没人懂还是我说的不清楚

难道真的没人懂还是我说的不清楚??

kryiran 发表于 2008-8-24 19:35:41

还是没人会么?

帮我看看啊一直顶到回答了为止

clonecd 发表于 2008-8-24 22:12:51

$aaa = _GUICtrlTreeView_GetText($TreeView1,(_GUICtrlTreeView_GetSelection($TreeView1)))

$fuxiangmu = _GUICtrlTreeView_GetParentParam($TreeView1, $aaa)


你这里第一句$aaa返回的是文本,而看帮助
_GUICtrlTreeView_GetParentParam($hWnd, $hItem = 0)

要求$hItem 是 item ID/Param,
参数出错当然返回False了。

kryiran 发表于 2008-8-24 22:46:23

那我因该怎么做呢?

那我因该怎么做呢?
页: [1]
查看完整版本: TreeView中_GetParentParam实现问题 什么回事?