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

[效率算法] 怎么选中输入框,让它处在编辑状态.<已解决>

  [复制链接]
发表于 2010-12-13 21:17:41 | 显示全部楼层 |阅读模式
本帖最后由 nbmpe 于 2010-12-13 21:56 编辑

例如我把第一个输入框输完成的时候,   点BUTTON1它会跳到第二个输入框内.   
也就是在不用鼠标的情况吧,使目标输入框处在录入状态,   用SEND  TAB 只能选中按顺序来,如果我要一个从INPUT3到INPUT1不用 TAB键.怎么处理.
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 617, 319, 192, 132)
$Input1 = GUICtrlCreateInput("Input1", 48, 24, 145, 24)
$Input2 = GUICtrlCreateInput("Input2", 232, 24, 177, 24)
$Input3 = GUICtrlCreateInput("Input3", 448, 24, 129, 24)
$Button1 = GUICtrlCreateButton("Button1", 176, 160, 113, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

        EndSwitch
WEnd

评分

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

查看全部评分

发表于 2010-12-13 21:45:33 | 显示全部楼层
使用  GUICtrlSetState (控件ID, $GUI_FOCUS)  可以将输入焦点调到该控件上
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 617, 319, 192, 132)
$Input1 = GUICtrlCreateInput("Input1", 48, 24, 145, 24)
$Input2 = GUICtrlCreateInput("Input2", 232, 24, 177, 24)
$Input3 = GUICtrlCreateInput("Input3", 448, 24, 129, 24)
$Button1 = GUICtrlCreateButton("Button1", 176, 160, 113, 33)
GUISetState(@SW_SHOW)

AdlibRegister("aa", 500)
$i = 1

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd
        
Func aa()
        If $i > 3 Then $i = 1
        GUICtrlSetState(Eval("Input" & $i), $GUI_FOCUS)
        $i += 1
EndFunc

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2010-12-13 21:54:36 | 显示全部楼层
回复 2# yhxhappy
这么简单.帮助文件看的少了.可以结帖了.
发表于 2010-12-13 21:59:03 | 显示全部楼层
回复 3# nbmpe


    多多看帮助...真的有帮助
发表于 2010-12-13 23:00:54 | 显示全部楼层
本来想说ControlFocus的  看了二楼的 发现这个更方便直接一点
发表于 2010-12-14 14:17:22 | 显示全部楼层
还是取控件焦点的问题哦
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-28 03:26 , Processed in 0.089186 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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