找回密码
 加入
搜索
查看: 2936|回复: 5

[系统综合] 如果在輸入框按下Enter就執行某個function [已解决]

  [复制链接]
发表于 2011-1-16 16:42:43 | 显示全部楼层 |阅读模式
本帖最后由 sta 于 2011-1-16 21:52 编辑

我想在輸入框中做到可以按下Enter就執行某個function的功能

我要如何做?
发表于 2011-1-16 17:23:23 | 显示全部楼层
看看帮助里的GUISetAccelerators
多体会你就明白了
发表于 2011-1-16 20:01:39 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>

Opt("TrayMenuMode", 1)
Global $aArray, $list_path,$list_iccode,$list_ictype,$list_softpath,$list_checksum,$list_flag
Global $sFilePath1 = "c:\list.xls" ; Path of Excel list This file should already exist               
                                               
#Region ### START Koda GUI section ### Form=e:\autoit\koda_2007.07.07\forms\aform1.kxf




;;;;;;;;;;;;;;;;;;;;;;;

$AForm1 = GUICreate("烧录站参数设定辅助工具", 300, 154)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF00FF)

$Group1 = GUICtrlCreateGroup("@ ! @", 8, 8, 284, 137)
$Label1 = GUICtrlCreateLabel("", 64, 3, 4, 4)
$Label2 = GUICtrlCreateLabel(" 在下框中输入要烧录的 SN 条码 ", 58, 30, 200, 17)
;$Address = GUICtrlCreateInput("SN ", 136, 52, 200, 21)
$SN = GUICtrlCreateInput("Input SN", 40, 56, 220, 21)
;$Run = GUICtrlCreateButton("打开(&O)", 104, 96, 113, 25, 0)
$Run = GUICtrlCreateButton("打开(&O)", 45, 98, 77, 25, 0)
$Exit = GUICtrlCreateButton("退出(&X)", 185, 98, 74, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Dim $AccelKeys[2][2]=[["{Enter}", $SN], ["{Enter}", $Run]]
GUISetAccelerators($AccelKeys)

GUISetState(@SW_SHOW)


While 1
        $Msg = GUIGetMsg()
        Select
                    Case $Msg = $GUI_EVENT_CLOSE Or $Msg = $Exit
                        Exit
                                        Case $Msg =  $SN
                                       
                                                _msg()
                                               
                       
                                          
               
                 

EndSelect
WEnd





Func _msg()
MsgBox(0,"","OK")

EndFunc
发表于 2011-1-16 20:24:02 | 显示全部楼层
 楼主| 发表于 2011-1-16 21:51:48 | 显示全部楼层
謝謝,問題已經解決
发表于 2012-2-7 14:40:27 | 显示全部楼层
有用到!!多謝分享!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 23:33 , Processed in 0.099274 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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