找回密码
 加入
搜索
查看: 2261|回复: 5

[GUI管理] 函数GUICtrlSetData中参数“-1”是什么意思?

  [复制链接]
发表于 2014-9-25 13:28:34 | 显示全部楼层 |阅读模式
以下是我查看GUICtrlSetData帮助文档中的例子,函数GUICtrlSetData ( 控件ID, 数据 [, 默认值] ),那-1这个参数是控件ID吗?



#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
        Local $msg
       
        GUICreate("My GUI")  ; will create a dialog box that when displayed is centered

        GUICtrlCreateCombo("", 10, 10)

        GUICtrlSetData(-1, "item1|item2|item3", "item3")

        GUISetState()       ; will display an empty dialog box with a combo control with focus on

        ; Run the GUI until the dialog is closed
        While 1
                $msg = GUIGetMsg()
               
                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd
EndFunc   ;==>Example
发表于 2014-9-25 15:32:50 | 显示全部楼层
控件ID,简单点讲你放在哪个控件下面就指的是哪个控件ID
发表于 2014-9-25 16:06:32 | 显示全部楼层
控件标识符(控件ID)
发表于 2014-9-25 17:51:58 | 显示全部楼层
回复 1# yinqc

这里可以看作是一个默认值,即代表最后创建成功的控件的ID。
 楼主| 发表于 2014-9-25 21:13:49 | 显示全部楼层
回复 4# user3000
有时这个控件ID就是一个变量名字,这也行吗?
发表于 2014-9-25 21:40:45 | 显示全部楼层
回复 5# yinqc

当然可以啊!
比如这样:
$Combo = GUICtrlCreateCombo("", 10, 10)
    GUICtrlSetData($Combo, "item1|item2|item3", "item3")
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-4 15:37 , Processed in 0.073375 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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