[已解决]怎么判断在输入框里输入数字,来改变radio是否选中
本帖最后由 痒痒 于 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
#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
happytc,好人啊!助人为乐! 谢谢大哥{:face (377):} 谢谢解答,又学到了哦,十分感谢 雷锋精神传天下!谢谢分享!
页:
[1]