When Checkbox is selected, Edit is disabled and the button is enabled. Conversely, if Edit is empty, the button is disabled, otherwise the button is enabled.
But when the program starts, the button is not enabled as expected. Why?
Code: Select all
Gui, Add, Checkbox, gtest vtest
Gui, Add, Edit,gtest2 vtest2, TEST
Gui, Add, Button, vok, OK
Gui, Show, h200 w300
f()
return
test:
GuiControlGet, test
if ( test = 1 )
{
GuiControl, Disable, test2
GuiControl, Enable, ok
}
else
{
GuiControl, Enable, test2
GuiControlGet, test2
if ( test2 = "" )
GuiControl, Disable, ok
}
return
test2:
GuiControlGet, test2
if ( test2 = "" )
GuiControl, Disable, ok
else
GuiControl, Enable, ok
return
f()
{
test := 1
GuiControl,, test, 1
GuiControl,, test2 ; Possible conflict
if ( test = 1 )
GuiControl, Enable, ok ; Not enabled as expected
return
}
I think that GuiControl,, test2 will cause the test2 subroutine to be executed, but after execution, it will continue to execute the following if statement, but the button is still not enabled.