|
比如现在要获取上图的“甄子丹”的值,如果不先用左键选中的话,用右键菜单获取的是原来选定的值,问怎样才能不先选中,直接用右键定位就可以获取,望好心帮下忙!代码如下:
#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiTreeView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 154, 162, 192, 124)
$TreeView1 = GUICtrlCreateTreeView(8, 8, 89, 137)
$TreeView1_0 = GUICtrlCreateTreeViewItem("武打明星", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("成龙", $TreeView1_0)
$TreeView1_2 = GUICtrlCreateTreeViewItem("甄子丹", $TreeView1_0)
$tx_menu = GUICtrlCreateContextMenu($TreeView1 );在指定控件或GUI窗口上创建右键菜单。GUICtrlCreateContextMenu ( [控件ID] )
$tx_1=GUICtrlCreateMenuItem("读取成龙", $tx_menu)
$tx_2=GUICtrlCreateMenuItem("读取甄子丹", $tx_menu)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $tx_1
MsgBox(0,"re", _GUICtrlTreeView_GetText($TreeView1, GUICtrlRead($TreeView1)))
case $tx_2
MsgBox(0,"re", _GUICtrlTreeView_GetText($TreeView1, GUICtrlRead($TreeView1)))
EndSwitch
WEnd |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|