#include <GuiConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> ; $hGUI = GUICreate("Input Auto-Tab Demo", 300, 180) $Input_1 = GUICtrlCreateInput("", 20, 20, 260, 20) $Input_2 = GUICtrlCreateInput("", 20, 50, 260, 20) $Input_3 = GUICtrlCreateInput("", 20, 80, 260, 20) ;~ GUICtrlSetLimit($Input_1, 5) ;~ GUICtrlSetLimit($Input_2, 5) ;~ GUICtrlSetLimit($Input_3, 5) $Ok_Button = GUICtrlCreateButton("Ok", 20, 140, 60, 20) $Exit_Button = GUICtrlCreateButton("Exit", 100, 140, 60, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Exit_Button ExitLoop Case $Ok_Button MsgBox(64, "...", "Ok - This is a Test", 0, $hGUI) EndSwitch WEnd Func WM_COMMAND($hWnd, $nMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0xFFFF) Switch $nID Case $Input_1, $Input_2, $Input_3 Switch $nNotifyCode Case $EN_UPDATE Local $sRead_Input = GUICtrlRead($nID) Local $sFirstChars = StringLeft($sRead_Input, 3) If StringLen($sRead_Input) >= 5 Then If $nID = $Input_3 Then GUICtrlSetState($Ok_Button, $GUI_FOCUS) Else GUICtrlSetState($nID+1, $GUI_FOCUS) EndIf GUICtrlSetData($nID, StringLeft($sRead_Input, 5)) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc |