找回密码
 加入
搜索
查看: 3909|回复: 8

[AU3基础] [已解决]菜鸟提问:关于回车键设置。

  [复制链接]
发表于 2010-4-27 00:01:53 | 显示全部楼层 |阅读模式
本帖最后由 king8462 于 2010-4-28 12:16 编辑

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Form1", 368, 237, 268, 268)
$Label1 = GUICtrlCreateLabel("姓名", 113, 40, 52, 17)
GUICtrlSetTip(-1, "1")
$Input1 = GUICtrlCreateInput("", 185, 40, 76, 21)
$Input2 = GUICtrlCreateInput("", 185, 80, 76, 21)
$Input3 = GUICtrlCreateInput("", 185, 120, 76, 21)
$OK_Btn = GUICtrlCreateButton("确定", 81, 208, 76, 28, 0)
$Button1 = GUICtrlCreateButton("退出", 217, 208, 76, 28, 0)
$Label2 = GUICtrlCreateLabel("性别", 113, 88, 52, 17)
$Label3 = GUICtrlCreateLabel("性别", 113, 128, 52, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

                Case $Form1_1
        EndSwitch
WEnd

代码如上。
请教:
在Input1中输入姓名内容后怎么才能按回车键进入Input2性别输入框,而不需要按tab键。

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-4-27 09:45:56 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{Enter}", "captureEsc")
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Form1", 368, 237, 268, 268)
$Label1 = GUICtrlCreateLabel("姓名", 113, 40, 52, 17)
GUICtrlSetTip(-1, "1")
$Input1 = GUICtrlCreateInput("", 185, 40, 76, 21)
$Input2 = GUICtrlCreateInput("", 185, 80, 76, 21)
$Input3 = GUICtrlCreateInput("", 185, 120, 76, 21)
$OK_Btn = GUICtrlCreateButton("确定", 81, 208, 76, 28, 0)
$Button1 = GUICtrlCreateButton("退出", 217, 208, 76, 28, 0)
$Label2 = GUICtrlCreateLabel("性别", 113, 88, 52, 17)
$Label3 = GUICtrlCreateLabel("性别", 113, 128, 52, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func captureEsc()
    ; 这里可定义要做的各种任务 
    Send("{Tab}")
EndFunc

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

                Case $Form1_1
        EndSwitch
WEnd
发表于 2010-4-27 09:52:52 | 显示全部楼层
3mile 发表于 2010-4-27 09:45


楼上这个方法倒是可行,不过有个问题是,这样会影响所有回车键。
也就是说当运行这个窗体的时候,在其他窗体上按回车一样会出现相同的效果。
发表于 2010-4-27 10:00:37 | 显示全部楼层
学习中....帮助有得嘛!
发表于 2010-4-27 10:22:11 | 显示全部楼层
本帖最后由 boyhong 于 2010-4-27 10:27 编辑

再接着改造一下呢?
$ccautodeng= WinWait("窗口名","",3)
If $ccautodeng <>0 Then
WinWaitActive("窗口名", "")
Send("{Tab}")
endif
发表于 2010-4-27 10:30:32 | 显示全部楼层
楼上这个方法倒是可行,不过有个问题是,这样会影响所有回车键。
也就是说当运行这个窗体的时候,在其 ...
水木子 发表于 2010-4-27 09:52
Func captureEsc()
   If WinActive("Form1") Then   
           ;判断激活的窗体是不是程序的窗体。
       ;如果是才发送TAB, 否则不发送。

    Send("{Tab}")
   EndIf
EndFunc
这样判断下就可以了。
发表于 2010-4-27 10:31:29 | 显示全部楼层
不好意思,菜鸟我没有看懂楼上大大们的意思,能不能在自身来个AdlibRegister并且如下:
#Include <Misc.au3>
if  _IsPressed(0D) then Send("{Tab}")
发表于 2010-4-27 10:37:52 | 显示全部楼层
楼主的问题和这个问题类似,看看吧!
http://www.autoitx.com/forum.php ... mp;page=1#pid148576
 楼主| 发表于 2010-4-28 12:15:48 | 显示全部楼层
谢谢楼上几位的帮助!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-9 19:41 , Processed in 0.096779 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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