小凯 发表于 2010-5-21 22:29:18

关于View自动选择的问题

如代码所示,当$ListView1添加到$ListView2之后,必需再点击$ListView1才可以添加
问题就是:怎么才能$ListView1添加到$ListView2之后,默认选择到$ListView1的第一项,然后再点添加又可以添加到$ListView2.
说明下.GUICtrlCreateListViewItem("01|加速|ED031R",$ListView1) 这些只是表达用的,具体程序是读取ini文件.
不知道我表达的够详细么.期待高手解答.
努力--认真---学习---探索----#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 534, 297, 192, 114)
$ListView1 = GUICtrlCreateListView("编号|功能|状态", 24, 16, 185, 241)
$Button1 = GUICtrlCreateButton("添加→", 224, 80, 73, 25)
$ListView2 = GUICtrlCreateListView("编号|功能|状态", 309, 16, 185, 241)
GUICtrlCreateListViewItem("01|加速|ED031R",$ListView1)
GUICtrlCreateListViewItem("02|加倍|ED032R",$ListView1)
GUICtrlCreateListViewItem("03|负重|ED033R",$ListView1)
GUICtrlCreateListViewItem("04|攻速|ED034R",$ListView1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
        $q = _GUICtrlListView_GetSelectedIndices($ListView1, True)
        If UBound($q) > 1 Then
                GUICtrlCreateListViewItem(GUICtrlRead(GUICtrlRead($ListView1)),$ListView2)
                _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView1))
                EndIf
EndSwitch
WEnd

lanfengc 发表于 2010-5-21 23:11:21

_GUICtrlListView_SetItemSelected($ListView1,0)在你的ENDIF之前加上这句。
页: [1]
查看完整版本: 关于View自动选择的问题