GuiControlGet issue in AHK 1.1.26.00

Report problems with documented functionality
Humbug
Posts: 18
Joined: 14 Jul 2017, 14:11

GuiControlGet issue in AHK 1.1.26.00

14 Jul 2017, 14:20

Hi folks,
I am using 1.1.26.00, the x64 build in specific.

Here's a piece of code:

Code: Select all

IsButtonDisabled()
{
  OutputDebug, IsButtonDisabled
  CtrlState:=0
  GuiControlGet CtrlState, Enabled, Button12
  OutputDebug, CtrlState: %CtrlState%
  return CtrlState 
}
Output 'as is':

Code: Select all

[2796] IsButtonDisabled
[2796] CtrlState: 0
Output when commenting out "CtrlState:=0"

Code: Select all

[932] IsButtonDisabled
[932] CtrlState: 
The outputs are always the same, regardless the state of the button.
Tried with a checkbox, same result.

I suspect a bug. Could someone validate?

Thanks!
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: GuiControlGet issue in AHK 1.1.26.00

14 Jul 2017, 20:08

GuiControlGet does not set its output variable if there is no such control, but it sets ErrorLevel to 1 instead of 0.

If I add the requisite buttons, your code works just fine.

Code: Select all

Loop 12
    Gui Add, Button, Disabled, Button %A_Index%
MsgBox % IsButtonDisabled() " " ErrorLevel
ExitApp

IsButtonDisabled()
{
  OutputDebug, IsButtonDisabled
  ; CtrlState:=0
  GuiControlGet CtrlState, Enabled, Button12
  OutputDebug, CtrlState: %CtrlState%
  return CtrlState 
}
Either you don't have 12 buttons, or your GUI window is not the default one (in which case you must specify the correct GUI).

(I have moved the topic to Ask for Help, and then back to Bug Reports, because the documentation indicates the output variable should be made blank in this situation.)
Humbug
Posts: 18
Joined: 14 Jul 2017, 14:11

Re: GuiControlGet issue in AHK 1.1.26.00

15 Jul 2017, 15:43

AU3Spy tells me that ClassNN is Button12.
I'll look into your tip on 'correct GUI' and get back on that.
Thanks!

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 23 guests