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

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

问题描述

下面的是我的程序.我的目的是在用户按下按钮之后显示三个 CheckBoxes .单击ok-按钮后,它们确实会出现,但是我无法单击 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

推荐答案

问题是标签比其所需的要大很多(600像素高),并且掩盖了复选框.要解决此问题,只需将高度更改为更合理的值(我通常将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天全站免登陆