如何使GUICtrlCreateListView 默认选中某行
#include <GUIConstants.au3>#include <GuiListView.au3>
Opt("TrayIconHide", 1)
GUICreate("程序", 350, 70, -1, -1)
$a= GUICtrlCreateButton("打印", 300, 10, 50, 50)
$List = GuiCtrlCreateListview("IC卡号|姓名|身份证号", 0, 0, 300, 70)
GuiCtrlCreateListViewItem("11111|aaa|bbbjhjhjhjhjhjh",$list)
GuiCtrlCreateListViewItem("2222|bbb|ddd",$list )
GuiCtrlCreateListViewItem("3333|bbb|ddd",$list )
GuiCtrlCreateListViewItem("4444|bbb|ddd",$list )
GuiCtrlCreateListViewItem("5555|bbb|ddd",$list )
_GUICtrlListView_SetItemChecked($List,4,true)
GUISetState(); display the GUI
Do
$msg = GUIGetMsg()
Select
Case $msg= $a
$dd="鼠标选中:"&_GUICtrlListViewGetItemText($List, _GUICtrlListViewGetSelectedIndices($List))
msgbox(0,"",_GUICtrlListView_GetSelectedCount($list))
MsgBox(0, "", $dd)
exit
EndSelect
Until $msg = $GUI_EVENT_CLOSE
我想默认选择第四行...可是直接按打印 会发现没有选中任何一行
[ 本帖最后由 joydog 于 2008-10-6 17:45 编辑 ] GUICtrlSetData ( 控件ID, 数据 [, 默认值] )... 3.2.13.7测试通过。
#include <GUIConstants.au3>
#include <GuiListView.au3>
Opt("TrayIconHide", 1)
GUICreate("程序", 350, 70, -1, -1)
$a= GUICtrlCreateButton("打印", 300, 10, 50, 50)
$List = GuiCtrlCreateListview("IC卡号|姓名|身份证号", 0, 0, 300, 70)
GuiCtrlCreateListViewItem("11111|aaa|bbbjhjhjhjhjhjh",$list)
GuiCtrlCreateListViewItem("2222|bbb|ddd",$list )
GuiCtrlCreateListViewItem("3333|bbb|ddd",$list )
GuiCtrlCreateListViewItem("4444|bbb|ddd",$list )
GuiCtrlCreateListViewItem("5555|bbb|ddd",$list )
_GUICtrlListView_SetItemSelected($List, 4)
GUISetState(); display the GUI
Do
$msg = GUIGetMsg()
Select
Case $msg= $a
$dd="鼠标选中:"&_GUICtrlListView_GetItemText($List, Int(_GUICtrlListView_GetSelectedIndices($List)))
msgbox(0,"",_GUICtrlListView_GetSelectedCount($list))
MsgBox(0, "", $dd)
;exit
EndSelect
Until $msg = $GUI_EVENT_CLOSE
居士呀...你就是我的神!!!!
哈哈..搞定了 学习了........ 留个脚印,以备后用。 _GUICtrlListView_SetItemChecked($List,4,true)
页:
[1]