Function Reference

首页  后退  前进

GUICtrlGetState

 

获取控件的当前状态.

 

GUICtrlGetState ( controlID )

参数

controlID

使用 GUICtrlCreate...() 创建控件类函数返回的控件标识符, 或 -1 使用前面创建的控件.

返回值

成功:

返回状态值. 具体值参考 GUICtrlSetState.

失败:

返回 -1, 控件未定义.

备注

GUICtrlRead() 不同, 本函数仅返回控件状态:

enabled = 激活

disabled = 禁用

hidden = 隐藏

show = 显示

dropaccepted = 接受拖放

 

例外:

对于 ListView 控件, 本函数将返回点击的列号.

相关

GUICtrlRead, GUICtrlSetState

函数示例

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
    GUICreate("My GUI (GetControlState)")
    Local $idCheckbox = GUICtrlCreateCheckbox("checkbox", 10, 10)
    GUICtrlSetState(-1, 1) ; checked
    GUISetState(@SW_SHOW) ; will display an empty dialog box
    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    MsgBox($MB_SYSTEMMODAL, "state", StringFormat("GUICtrlRead=%d\nGUICtrlGetState=%d", GUICtrlRead($idCheckbox), GUICtrlGetState($idCheckbox)))
EndFunc   ;==>Example

----------------------------------------