问题描述
我需要代码方面的帮助.
i ńeed help with my code.
GUICtrlSetState($input_ID_betonarna,$gui_ENABLE)
ConsoleWrite(GUICtrlGetState($input_ID_betonarna)&" "& $gui_ENABLE)
输出是:80 64
预期输出是:64 64
Expected output is:64 64
我知道输出是状态的总和,但我没有任何带有 GUIConstantsEx 值的表.
I know that output is sum of states but i do not have any table with GUIConstantsEx values.
推荐答案
查看您的 AutoIt 安装.在include"子文件夹中,您应该找到定义这些常量的文件 GUIConstantsEx.au3:
Look into your AutoIt installation. In the "include" subfolder you should find the file GUIConstantsEx.au3 where those constants are defined:
Global Const $GUI_SHOW = 16
Global Const $GUI_HIDE = 32
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128
你得到值 80 的原因是因为这是一个位掩码,控件实际上有 2 种状态:它被启用和显示,所以:
The reason you get the value of 80 is because this is a bit mask and the control actually has 2 states: It is enabled and shown, so:
$GUI_SHOW = 16
$GUI_ENABLE = 64
总和是 80,这就是您在输出中得到的.
The sum is 80 and that's what you got in your output.
如果您想针对特定状态测试控件的状态,例如切换按钮的状态,则可以使用 BitAND 运算符:
If you want to test the state of a control for a specific state, for example to toggle the state of a button, then you can use the BitAND operator:
If BitAND(GUICtrlGetState($cmdOk), $GUI_DISABLE) = $GUI_DISABLE Then
GUICtrlSetState($cmdOk, $GUI_ENABLE)
EndIf
这篇关于AutoIT GUICtrlSetState/GUICtrlGetState 设置状态与获取状态不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!