无法单击 AutoIt 中的复选框 [英] Unable to click on the CheckBox in AutoIt

查看:34
本文介绍了无法单击 AutoIt 中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的程序.这里我的目的是在用户按下 Button 后显示三个 CheckBoxes.单击 ok-Button 后确实会出现它们,但是我无法单击 CheckBoxes.可能是什么原因?

The below one is my program. Here my intention is to display the three CheckBoxes after the user presses the Button. They do appear after clicking the ok-Button, but I'm unable to click on the CheckBoxes. What could be the reason?

#include <GUIConstants.au3>  
$gui = GuiCreate("Hello World", 700, 600) 
$Label_HelloWorld = GuiCtrlCreateLabel("Path", 40, 20, 300, 600)
$Button_OK = GuiCtrlCreateButton("OK", 450, 20, 50, 20)    

GuiSetState(@SW_SHOW, $gui) 
While True
    $guimsg = GuiGetMsg()
    Select
        Case $guimsg == $GUI_EVENT_CLOSE
            GuiDelete($gui)
            ExitLoop

        Case $guimsg == $Button_OK
            $Label_sub_folder1 = GuiCtrlCreateLabel("Select the subfolder", 40, 65, 300, 600) 
            $CheckBox1 = GUICtrlCreateCheckbox('functionality', 40, 85, 80, 23)
            $CheckBox2 = GUICtrlCreateCheckbox('performance', 160, 85, 80, 23)
            $CheckBox3 = GUICtrlCreateCheckbox('listening', 280, 85, 80, 23)
            Sleep(50000)
            ExitLoop

    EndSelect
WEnd

推荐答案

问题是标签比它需要的大很多(600px 高),并且覆盖了复选框.要修复,只需将高度更改为更合理的值(我通常为单行标签使用 18px).

The problem is that the label is a lot larger than it needs to be (600px tall), and is covering up the checkboxes. To fix just change the height to a more reasonable value (I usually use 18px for single line labels).

另外要注意的是,您不应该在消息循环中睡觉.消息只会排队,GUI 不会响应.相反,您应该有一个可以在后台运行的计时器.

As an extra note, you shouldn't sleep inside a message loop. The messages will just queue up and the GUI will not be responsive. Instead you should have a timer that can run in the background.

这篇关于无法单击 AutoIt 中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆