Tải bản đầy đủ (.pdf) (6 trang)

Giáo Trình How To Use AutoIt A Professional Manner part 58 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (76.71 KB, 6 trang )

GUICtrlSetData ( controlID, data [, default] )
Parameters
controlID control id
data
đối với Combo, List, ListView, ListViewItem : các item đc phân cách
nhau bởi dấu separated đc đặt
trong Opt("GUIDataSeparatorChar", ) (mặc định là dấu "|")
đối với Progress : giá trị phần trăm
đối với Slider : giá trị
đối với Group, Label, Button, Checkbox, Radio, Combo, List, Input,
Edit, TabItem : văn bản mới
đối với Date : thời gian mới theo kiểu của control
đối với TreeViewItem: văn bản mới
đối với Dummy : giá trị
default
đối với Combo, List : giá trị mặc định.
đối với Edit, Input : nếu đoạn văn bản mới ko rỗng (<>"") và control
đc định nghĩa ko ghi đè thì đoạn văn bản sẽ đc chèn vào chỗ con trỏ
đang đứng

Return Value
Success:

Returns 1.
Failure:

Returns 0.
Returns -1 nếu sai dữ liệu

Remarks
cho Combo hay List control :


dữ liệu thêm vào sẽ đc add thêm vào cuối
nếu dữ liệu đc bắt đầu bởi kí tự GUIDataSeparatorChar hoặc một chuỗi rỗng ("")
thì dữ liệ cũ sẽ bị xóa bỏ

cho ListView, ListViewItem controls :
dữ liệu rỗng = "" nghĩa là giữ nguyên, vd thay đổi cột thứ 3 thành update ta viết
"||update"
nếu dữ liệu ko đủ kí tự GUIDataSeparatorChar thì cột sẽ bị xóa, vd "|" sẽ xóa cột
thứ 2, "" sẽ xóa cột đầu
Related
GUICtrlCreate , GUICtrlSet , GUICtrlRead, GUIDataSeparatorChar (Option)
Example

#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



Function Reference
GUICtrlSetDefBkColor
đặt mầu nền mặc định cho tất cả control trên GUI.
GUICtrlSetDefBkColor ( defbkcolor [, winhandle] )
Parameters
defbkcolor

mầu.
winhandle handle của GUI

Return Value
Success:

Returns 1.
Failure:

Returns 0.


Remarks
ở các phiên bản trước của autoit (trước v3.0.102) thì màu BGR đc dùng, sau phiên
bản này thì màu RGB đc dùng, kiểu màu này có thể đc thay đổi ở opt(
"ColorMode", )


Related
ColorMode (Option), GUICreate, GUICtrlSetDefColor
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $msg

GUICreate("test GUISetTextColor", 100,100) ; will create a dialog box that
when displayed is centered

GUICtrlSetDefBkColor(0xFF0000) ; will change text color for all defined
controls

GUICtrlCreateLabel("label", 10,5)

GUICtrlCreateRadio("radio", 10,25,50)
GUICtrlSetBkColor(-1, 0x0000FF) ; will change text color for specified control


GUICtrlCreateButton("button", 10,55)

GUISetState() ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example



Function Reference
GUICtrlSetDefColor
đặt mầu mặc định cho tất cả control trên GUI.
GUICtrlSetDefColor ( deftextcolor [, winhandle] )
Parameters
deftextcolor

màu chữ
winhandle handle của GUI

Return Value
Success:

Returns 1.
Failure:


Returns 0.

Remarks
ở các phiên bản trước của autoit (trước v3.0.102) thì màu BGR đc dùng, sau phiên
bản này thì màu RGB đc dùng, kiểu màu này có thể đc thay đổi ở opt(
"ColorMode", )
Related
ColorMode (Option), GUICreate, GUICtrlSetDefBkColor
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $msg

GUICreate("test GUISetTextColor", 100,100) ; will create a dialog box that
when displayed is centered

×