Goodmorning people,
I've been busy with a usefull script for work but one part is not working as I thought it would.
I took the known _IsEnabled function, change 3 words to have it check an disabled checkbox status
The code below is not the actual script but it demonstrates the error.
If you select "Check all but disabled" it will select all 3 checkboxes which is not my intention, ehh help?
#include <MsgBoxConstants.au3>
#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
Local $box[03]
GuiCreate("Test", 300, 300, -1, -1)
$box[00] = GUICtrlCreateCheckbox("Unchecked", 20, 40, 240, 20)
$box[01] = GUICtrlCreateCheckbox("Disabled", 20, 60, 240, 20)
$box[02] = GUICtrlCreateCheckbox("Checked", 20, 80, 240, 20)
GUICtrlSetState($box[00], $GUI_UNCHECKED)
GUICtrlSetState($box[01], $GUI_DISABLE)
GUICtrlSetState($box[02], $GUI_CHECKED)
$Button_Ok = GUICtrlCreateButton("Check all but Disabled", 20 , 110, 180, 45)
$Button_KO = GUICtrlCreateButton("UnCheck all", 20 , 155, 180, 45)
GuiSetState()
Func _IsDisable($control)
Return BitAND(GUICtrlRead($control), $GUI_DISABLE) = $GUI_DISABLE
EndFunc
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $Button_Ok
For $i = 0 to 2
If _IsDisable($box[$i]) Then
GUICtrlSetState($box[$i], $GUI_UNCHECKED)
Else
GUICtrlSetState($box[$i], $GUI_CHECKED)
EndIf
Next
Case $msg = $Button_KO
For $i = 0 to 2
GUICtrlSetState($box[$i], $GUI_UNCHECKED)
Next
EndSelect
WEnd