找回密码
 加入
搜索
查看: 2202|回复: 1

[GUI管理] [AU2管理]【list选中】 _GUICtrlListBox_ClickItem方法怎么不能选中第三方GUI

[复制链接]
发表于 2011-11-9 00:45:35 | 显示全部楼层 |阅读模式
代码描述
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hListBox

    ; Create GUI
    GUICreate("List Box Click Item_GUICtrlListBox_ClickItem", 400, 296)
    $hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
        MsgBox(0,"ss",$hListBox)
    GUISetState()

    ; Add strings
    _GUICtrlListBox_BeginUpdate($hListBox)
    For $iI = 1 To 9
        _GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

    ; Click an item
    _GUICtrlListBox_ClickItem($hListBox, 4, "left", True)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main
以上是自己先创建一个list然后在选中,具体方法是使用了_GUICtrlListBox_ClickItem方法,
为什么我用_GUICtrlListBox_ClickItem选中第三方GUI时在list中无法选中呢。我用的是 window info 工具德到第三方GUI 的$hListBox 值。。。。。
求高人解答
发表于 2011-11-11 11:11:05 | 显示全部楼层
本帖最后由 xiehuahere 于 2011-11-11 11:14 编辑

用 ControlCommand 试试。
"SelectString", 'string'
Sets selection according to string in a ListBox

"SetCurrentSelection", occurrence
Sets selection to occurrence ref in a ListBox
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-3 21:58 , Processed in 0.086040 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表