AutoIT Help part 75 pdf

6 261 0
AutoIT Help part 75 pdf

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

Thông tin tài liệu

Function Reference GUICtrlRead đọc trạng thái hay dữ liệu của control. GUICtrlRead ( controlID [, advanced] ) Parameters controlID control id advanced 0 = (mặc định) trả lại giá trị đọc đc 1 = trả lại thông tin mở rộng của control. Return Value Success: trả lại giá trị đọc đc Failure: Returns 0. control giá trị trả lại Checkbox, Radio trạng thái của control 1 = ticked 4 = untick Combo, List giá trị đc chọn Input, Edit văn bản đc nhập vào Button caption Date ngày đc chọn Progress phần trăm hiện tại Slider giá trị hiện tại Tab số thứ tự tao item đc chọn Menu, MenuItem trạng thái của control xem bảng trạng thái See State table TreeView controlID của TreeViewItem đc chọn TreeViewItem State của TreeViewItem ListView controlID của ListViewItem đc chọn. 0: nếu ko có item nào đc chọn Dummy giá trị đc đặt bởi GUICtrlSendToDummy hay GUICtrlSetData Remarks thông tin mở rộng control giá trị trả lại Checkbox, Radio caption. Menu, MenuItem caption TreeView caption của TreeViewItem đc chọn TreeViewItem caption ListViewItem trạng thái của ListViewItem Tab controlID của tabitem đc chọn For Checkbox, Radio control several states can be returned as $GUI_FOCUS and $GUI_CHECKED,. So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the control is checked. For Listview items several states can be returned as $GUI_CHECKED and $GUI_UNCHECKED (only for listview controls with LVS_EX_CHECKBOXES- exstyle and on 'advanced' return) . So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the item is checked. For Treeview items several states can be returned as $GUI_FOCUS, $GUI_EXPAND and $GUI_CHECKED, $GUI_UNCHECKED (only for treeview controls with TVS_CHECKBOXES-style . So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the item is checked. Related GUICtrlSet , GUIGetMsg, GUIEventOptions (Option) Example #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $menu1, $n1, $n2, $msg, $menustate, $menutext GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered $menu1 = GUICtrlCreateMenu("File") $n1 = GUICtrlCreateList("", 10, 10, -1, 100) GUICtrlSetData(-1, "item1|item2|item3", "item2") $n2 = GUICtrlCreateButton("Read", 10, 110, 50) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button GUISetState() ; will display an empty dialog box ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() If $msg = $n2 Then MsgBox(0, "Selected listbox entry", GUICtrlRead($n1)) ; display the selected listbox entry $menustate = GUICtrlRead($menu1) ; return the state of the menu item $menutext = GUICtrlRead($menu1, 1) ; return the text of the menu item MsgBox(0, "State and text of the menuitem", "state:" & $menustate & @LF & "text:" & $menutext) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Function Reference GUICtrlRecvMsg Send a message to a control and retrieve information in lParam. GUICtrlRecvMsg ( controlID , msg [, wParam [, lParamType]] ) Parameters controlID The control identifier (controlID) as returned by a GUICtrlCreate function. msg type of message to be send to the control as defined in the Windows controls documentation. wParam [optional] An integer first param to be send to the control. lParamType [optional] Define the type of lParam that will be returned: 0 (default) for wParam and lParam, 1 for lParam String, 2 for lParam RECT struct. Return Value Success: Returns the value returned by the SendMessage Windows API. Failure: Returns 0. Remarks This function allows the sending of special Windows messages directly to the control using the SendMessage API. It is used to enable special control features not available with the simple GUICtrlRead() and GUICtrlSet () range of functions. If the wParam and lParamType parameters are not specified then an array of two elements is returned (LPwParam, LPlParam). The RECT is returned in an array of 4 elements (Left, Top, Right, Bottom). Related GUICtrlSendMsg, GUICtrlSet , GUIGetMsg, GUICtrlRead Example #include <GUIConstantsEx.au3> #include <EditConstants.au3> GUICreate("My GUI") ; will create a dialog box that when displayed is centered $nEdit = GUICtrlCreateEdit ("line 0", 10,10) GUICtrlCreateButton ("Ok", 20,200,50) GUISetState () For $n=1 To 5 GUICtrlSetData ($nEdit, @CRLF & "line "& $n) Next ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() If $msg >0 Then $a=GUICtrlRecvMsg($nEdit, $EM_GETSEL) GUICtrlSetState($nEdit,$GUI_FOCUS) ; set focus back on edit control ; will display the wParam and lParam values return by the control MsgBox(0,"Current selection",StringFormat("start=%d end=%d", $a[0],

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