Gets the current state of a control.
GUICtrlGetState ( controlID )
controlID | The control identifier (controlID) as returned by a GUICtrlCreate...() function, or -1 for the last created control. |
Success: | the state. See GUICtrlSetState() for values. |
Failure: | -1 if control is not defined. |
As opposed to GUICtrlRead() this function returns ONLY the state of a control enabled/disabled/hidden/show/dropaccepted
Exceptions:
For ListView controls it returns the number of the clicked column.
#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