|
发表于 2009-12-30 15:43:25
|
显示全部楼层
本帖最后由 sanmoking 于 2010-1-2 02:40 编辑
不要用鼠标点击.......用检测更有效....
因为有的时候不是用鼠标来确定选择的条目.用上下箭头也能进行选择,这样你用点击来识别就不能用了不是.....
给你个例子..
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 228, 226, 192, 124)
$ListView = GUICtrlCreateListView("#|用户|代码", 8, 8, 209, 137)
For $i = 1 To 10
GUICtrlCreateListViewItem ($i&"|"&"user"&$i&"|"&Random(1000000,9999999,1),$listview)
Next
$Input1 = GUICtrlCreateInput("用户", 8, 152, 129, 21)
$Input2 = GUICtrlCreateInput("代码", 8, 184, 129, 21)
GUISetState(@SW_SHOW)
$shanchuidold = ""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
$shanchuid = ControlListView ($Form1, "", "SysListView321", "GetSelected", 0)
; $mac1 = ControlListView ($Form1, "", "SysListView321", "GetText", $shanchuid, 1)
; $mac2 = ControlListView ($Form1, "", "SysListView321", "GetText", $shanchuid, 2)
if $shanchuid = "" and $shanchuid <> $shanchuidold Then
GUICtrlSetData($Input2,"")
GUICtrlSetData($Input1,"")
ElseIf $shanchuid <> "" and $shanchuid <> $shanchuidold then
$mac1 = ControlListView ($Form1, "", "SysListView321", "GetText", $shanchuid, 1) ;放在这又会省下一点资源咯
$mac2 = ControlListView ($Form1, "", "SysListView321", "GetText", $shanchuid, 2)
GUICtrlSetData($Input2,$mac2)
GUICtrlSetData($Input1,$mac1)
EndIf
$shanchuidold = $shanchuid
WEnd
大概是这样子的, |
评分
-
查看全部评分
|