# Function Reference

GUICtrlGetState

Gets the current state of a control

GUICtrlGetState ( [controlID] )

Parameters

controlID | [optional] The control identifier (controlID) as returned by a GUICtrlCreate... function.

Return Value

Success: | Returns the state. See GUICtrlSetState for values.
Failure: | Returns -1 if control is not defined.

Remarks

As opposed to GUICtrlRead this function returns only the state of a control (disabled/hidden/etc)
Exceptions:
For ListView controls it returns the number of the clicked column.

Related

GUICtrlRead, GUICtrlSetState

Example

#include <GUIConstants.au3>
GUICreate ("My GUI (GetControlState)")
$n=GUICtrlCreateCheckbox ("checkbox",10,10)
GUICtrlSetState (-1,1) ; checked
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
msgbox (0,"state",StringFormat("GUICtrlRead=%d\nGUICtrlGetState=%d",GUICtrlRead($n),GUICtrlGetState($n)))