1. Trang chủ
  2. » Công Nghệ Thông Tin

AutoIT Help part 50 pptx

5 306 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 67,72 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

EndFunc ;==>Example Function Reference GUICtrlCreateMenuItem Creates a MenuItem control for the GUI.. GUICtrlCreateMenuItem "text", menuID [, menuentry [, menuradioitem]] Parameters

Trang 1

EndFunc ;==>Example

Function Reference

GUICtrlCreateMenuItem

Creates a MenuItem control for the GUI

GUICtrlCreateMenuItem ( "text", menuID [, menuentry [, menuradioitem]] )

Parameters

text The text of the control

menuID Allows you to create a submenu in the referenced menu If equal

-1 it refers to the first level menu

menuentry [optional] Allows you to define the entry number to be created

The entries are numbered starting at 0

menuradioitem [optional] 0 (default) = create a normal menuitem, 1 = create a

menuradioitem

Return Value

Success: trả lại ControlID

Failure: Returns 0

Remarks

để đặt các thuộc tính cho control ta dùng GUICtrlSet

nếu text = "" thì một dòng kẻ ngang sẽ đc hiện thị

Related

Trang 2

GUICtrlSet , GUIGetMsg, GUICtrlCreateMenu, GUICtrlCreateContextMenu

Example

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()

Local $defaultstatus, $status, $filemenu, $fileitem, $helpmenu, $saveitem

Local $infoitem, $exititem, $recentfilesmenu, $separator1, $viewmenu

Local $viewstatusitem, $okbutton, $cancelbutton, $statuslabel, $msg, $file

GUICreate("My GUI menu", 300, 200)

Global $defaultstatus = "Ready"

Global $status

$filemenu = GUICtrlCreateMenu("&File")

$fileitem = GUICtrlCreateMenuItem("Open", $filemenu)

GUICtrlSetState(-1, $GUI_DEFBUTTON)

$helpmenu = GUICtrlCreateMenu("?")

$saveitem = GUICtrlCreateMenuItem("Save", $filemenu)

GUICtrlSetState(-1, $GUI_DISABLE)

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

$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1)

$separator1 = GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line

$viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu)

GUICtrlSetState(-1, $GUI_CHECKED)

$okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20)

GUICtrlSetState(-1, $GUI_FOCUS)

Trang 3

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20)

$statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 165, 300, 16,

BitOR($SS_SIMPLE, $SS_SUNKEN))

GUISetState()

While 1

$msg = GUIGetMsg()

If $msg = $fileitem Then

$file = FileOpenDialog("Choose file ", @TempDir, "All (*.*)")

If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) EndIf

If $msg = $viewstatusitem Then

If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) =

$GUI_CHECKED Then

GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED)

GUICtrlSetState($statuslabel, $GUI_HIDE)

Else

GUICtrlSetState($viewstatusitem, $GUI_CHECKED)

GUICtrlSetState($statuslabel, $GUI_SHOW)

EndIf

EndIf

If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg =

$exititem Then ExitLoop

If $msg = $infoitem Then MsgBox(0, "Info", "Only a test ")

WEnd

GUIDelete()

EndFunc ;==>Example

Function Reference

GUICtrlCreateMonthCal

tạo một month calendar control cho GUI

Trang 4

GUICtrlCreateMonthCal ( "text", left, top [, width [, height [, style [, exStyle]]]] )

Parameters

text thời gian hiện trị sẵn trên control

left tọa độ X

width chiều rộng

height chiều cao

style

kiểu xem thêm GUI Control Styles Appendix

default (-1) : none

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

Default resizing is $GUI_DOCKSIZE

Related

GUICoordMode (Option), GUIGetMsg, GUICtrlRead

Example

#include <GUIConstantsEx.au3>

Trang 5

Opt('MustDeclareVars', 1)

Example()

Func Example()

Local $Date, $msg

GUICreate("Get date", 210, 190)

$Date = GUICtrlCreateMonthCal("1953/03/25", 10, 10)

GUISetState()

; Run the GUI until the dialog is closed or timeout

Do

$msg = GUIGetMsg()

If $msg = $Date Then MsgBox(0, "debug", "calendar clicked")

Until $msg = $GUI_EVENT_CLOSE

MsgBox(0, $msg, GUICtrlRead($Date), 2)

EndFunc ;==>Example

Function Reference

GUICtrlCreateObj

Creates an ActiveX control in the GUI

GUICtrlCreateObj ( $ObjectVar, left, top [, width [, height ]] )

Parameters

ObjectVar A variable pointing to a previously opened object

left The left side of the control If -1 is used then left will be computed

according to GUICoordMode

Ngày đăng: 02/07/2014, 17:21

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN