找回密码
 加入
搜索
查看: 1322|回复: 1

[AU3基础] 请问如何实现点击复选框,如何自动全选输入框中的内容

[复制链接]
发表于 2012-7-16 10:22:26 | 显示全部楼层 |阅读模式
点击复选框,如何自动全选输入框中的内容。
代码如下:
我想勾选复选框后,自动将键盘焦点放到输入框中,并且如果已有内容的话便自动全选里面的文字
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 444, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("选择我", 72, 120, 121, 17)
$Input1 = GUICtrlCreateInput("112233", 216, 120, 169, 21,$ES_PASSWORD)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
发表于 2012-7-16 10:57:20 | 显示全部楼层
本帖最后由 南一 于 2012-7-16 11:01 编辑


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 444, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("选择我", 72, 120, 121, 17)
$Input1 = GUICtrlCreateInput("112233", 216, 120, 169, 21, $ES_PASSWORD)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Checkbox1
                        $Checked = GUICtrlRead($Checkbox1)
                        If $Checked = $GUI_CHECKED Then
                                GUICtrlSetState($Input1, $GUI_FOCUS)
                        EndIf
        EndSwitch
WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 04:46 , Processed in 0.075314 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表