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

[AU3基础] [已解决]怎么判断在输入框里输入数字,来改变radio是否选中

  [复制链接]
发表于 2011-8-31 11:07:31 | 显示全部楼层 |阅读模式
本帖最后由 痒痒 于 2011-8-31 16:01 编辑

如果在input里输入03151111就选择中03 radio。如果输入04152222就选中04 radio……

不用正则可以办到么
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 268, 117, 455, 279)
$Radio1 = GUICtrlCreateRadio("03", 32, 24, 41, 17)
$Radio2 = GUICtrlCreateRadio("04", 72, 24, 41, 17)
$Radio3 = GUICtrlCreateRadio("05", 112, 24, 49, 17)
GUICtrlCreateInput("", 24, 64, 145, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 64, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

        EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-8-31 11:31:01 | 显示全部楼层

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 268, 117, 455, 279)
$Radio1 = GUICtrlCreateRadio("03", 32, 24, 41, 17)
$Radio2 = GUICtrlCreateRadio("04", 72, 24, 41, 17)
$Radio3 = GUICtrlCreateRadio("05", 112, 24, 49, 17)
$Input = GUICtrlCreateInput("", 24, 64, 145, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 64, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Input
                        If "03" == StringMid(GUICtrlRead($Input), 1, 2) Then GUICtrlSetState($Radio1, $gui_checked)
                        If "04" == StringMid(GUICtrlRead($Input), 1, 2) Then GUICtrlSetState($Radio2, $gui_checked)
                        If "05" == StringMid(GUICtrlRead($Input), 1, 2) Then GUICtrlSetState($Radio3, $gui_checked)                                
        EndSwitch
WEnd
发表于 2011-8-31 11:33:02 | 显示全部楼层
happytc,好人啊!助人为乐!
 楼主| 发表于 2011-8-31 16:01:58 | 显示全部楼层
谢谢大哥  
发表于 2011-10-20 14:14:22 | 显示全部楼层
谢谢解答,又学到了哦,十分感谢
发表于 2014-5-4 10:53:15 | 显示全部楼层
雷锋精神传天下!谢谢分享!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-13 02:15 , Processed in 0.081943 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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