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

AutoIT Help part 42 ppsx

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 (72.54 KB, 6 trang )

để lấy giá trị của control ta dùng GUICtrlRead.
để đặt các thuộc tính cho control ta dùng GUICtrlSet

để có thể dùng đc các biến trên ta cầnphair khai báo thư viện #include
<ButtonConstants.au3> in your script.

Default resizing is $GUI_DOCKHEIGHT.
Related
GUICoordMode (Option), GUICtrlSet , GUIGetMsg
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

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

$checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)

GUISetState() ; will display an dialog box with 1 checkbox

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

If $msg = $GUI_EVENT_CLOSE Then ExitLoop


WEnd
EndFunc ;==>Example



Function Reference
GUICtrlCreateCombo
tạo ra ComboBox control cho GUI để lựa chọn.
GUICtrlCreateCombo ( "text", left, top [, width [, height [, style [, exStyle]]]] )
Parameters
text chữ hiện trị trên combo
left tọa độ X
top tọa độ Y
width chiều rộng
height chiều cao
style
kiểu. xem thêm GUI Control Styles Appendix.

default (-1) : $CBS_DROPDOWN, $CBS_AUTOHSCROLL,
$WS_VSCROLL
forced style : $WS_TABSTOP
exStyle kiểu mở rộng. xem Extended Style Table.

Return Value
Success:

trả lại ControlID
Failure:

Returns 0.


Remarks
để lấy giá trị của control ta dùng GUICtrlRead.
để đặt các thuộc tính cho control ta dùng GUICtrlSet

để sử dụng nhiều kiểu trong style ta dùng BitOr($GUI_SS_DEFAULT_COMBO,
newstyle, ).

để có thể dùng đc các biến trên ta cần phải khai báo thư viện #include
<ComboConstants.au3> in your script.

Default resizing is $GUI_DOCKHEIGHT.
Related
GUICoordMode (Option), GUICtrlSetData, GUICtrlSet , GUIGetMsg
Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

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

GUICtrlCreateCombo("item1", 10, 10) ; create first item
GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new
default


GUISetState()

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

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



Function Reference
GUICtrlCreateContextMenu
tạo ra context menu (menu ngữ cảnh xuất hiện khi ta nháy chuột phải) cho GUI
hay control của GUI.
GUICtrlCreateContextMenu ( [controlID] )
Parameters
controlID controlID, mặc định là GUI

Return Value
Success:

trả lại ControlID
Failure:

Returns 0.

Remarks

mỗi 1 item của menu đc tạo bởi GUICtrlCreateMenuItem.
item con của item của menu đc tạo bởi GUICtrlCreateMenu.

1 control chỉ tạo đc 1 menu, và một số control mới tạo đc context menu 1 số ko có

chú ý 1 số control (như edit) ko thể đặt context menu đc bì nó mang context menu
của hệ thống
Related
GUICtrlCreateMenuItem, GUICtrlCreateMenu, GUICtrlGetHandle,
GUICtrlSetState, GUICtrlDelete
Example

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt('MustDeclareVars', 1)

Example1()
Example2()

; ****************
; * First sample *
; ****************
Func Example1()
Local $contextmenu, $button, $buttoncontext, $buttonitem, $msg
Local $newsubmenu, $textitem, $fileitem, $saveitem, $infoitem

;right click on gui to bring up context Menu.
;right click on the "ok" button to bring up a controll specific context menu.


GUICreate("My GUI Context Menu", 300, 200)

$contextmenu = GUICtrlCreateContextMenu()

$button = GUICtrlCreateButton("OK", 100, 100, 70, 20)
$buttoncontext = GUICtrlCreateContextMenu($button)
$buttonitem = GUICtrlCreateMenuItem("About button", $buttoncontext)

$newsubmenu = GUICtrlCreateMenu("new", $contextmenu)
$textitem = GUICtrlCreateMenuItem("text", $newsubmenu)

$fileitem = GUICtrlCreateMenuItem("Open", $contextmenu)
$saveitem = GUICtrlCreateMenuItem("Save", $contextmenu)
GUICtrlCreateMenuItem("", $contextmenu) ; separator

$infoitem = GUICtrlCreateMenuItem("Info", $contextmenu)

GUISetState()


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×