修改指定控件的相關(guān)數(shù)據(jù)。
GUICtrlSetData ( 控件ID, 數(shù)據(jù) [, 默認(rèn)值] )
參數(shù)
控件ID | 控件標(biāo)識(shí)符(控件ID),可由 GUICtrlCreate... 函數(shù)的返回值獲得。 |
數(shù)據(jù) | 對(duì)于 Combo、List、ListViewItem:由豎線 | 分開(kāi)的項(xiàng)目文本 對(duì)于 Progress:百分比 對(duì)于 Slider:(位置)值 對(duì)于 Group、Label、Button、Checkbox、Radio、Combo、List、Input、Edit、TabItem:更新文本 對(duì)于 Date:日期或時(shí)間,具體取決于控件風(fēng)格 對(duì)于 Dummy:值 |
默認(rèn)值 | [可選參數(shù)] 對(duì)于 Combo、List:默認(rèn)選中的項(xiàng)目 對(duì)于 Edit、Input:若此參數(shù)有定義而且不是 "" 則參數(shù)“數(shù)據(jù)”所含字符串將被插入到指針?biāo)谖恢煤螅ú⒎歉采w原有內(nèi)容)。 |
返回值
成功: | 返回值為1。 |
失敗: | 返回值為0。 |
返回值為 -1,說(shuō)明給定的數(shù)據(jù)無(wú)效。 |
注意
對(duì)于 Combo 或 List 控件:
相關(guān)
GUICtrlCreate..., GUICtrlSet..., GUICtrlRead
示例
#include <GUIConstants.au3>
GUICreate("我的 GUI") ; 創(chuàng)建一個(gè)居中顯示的窗口
GUICtrlCreateCombo ("", 10,10)
GUICtrlSetData(-1,"item1|item2|item3", "item3")
GUISetState () ; 空窗口,焦點(diǎn)設(shè)置到 combo 控件上
; 運(yùn)行腳本直到窗口被關(guān)閉
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend