Sign in to follow this  
Followers 0
sias

Auto-Tab between input boxes

3 posts in this topic

I am looking for a way to auto tab between input boxes after a certain amount of characters are typed in. I have tried using stringlen() and setting the focus to the next control using this code, placing it under each input box.

$length = StringLen(GUICtrlRead($bm))
If $length = 2 Then
    GUICtrlSetState($bd, $GUI_FOCUS)
EndIfoÝ÷ Øz0z÷«×hzÉí±ç¦¶!jx¶¡Ë¬¶azw±¶)éºÖèÄZ½æ¥²­µé©µçm¢­Ø§jZ(¥»­¶§Ü(ºWcºËfzË0ØfÉéí·¬r¸©´  òéiÂ¥u· ­æ­&©¦·«^u«­¢+Øí%¹ÁÕР ½áÌ)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí54½½eeedÅÕ½Ðì°ÄÈ°ÈÀ°´Ä°´Ä¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí! é54ÅÕ½Ðì°ÄÈ°ÌÔ¤(ÀÌØí´ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÔÀ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìµ½¹Ñ )U%
Ñɱ
ÉÑ1° ÅÕ½Ðì¼ÅÕ½Ðì°ÌÄ°ÔȤ(ÀÌØíôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÐÀ°ÔÀ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìä)U%
Ñɱ
ÉÑ1° ÅÕ½Ðì¼ÅÕ½Ðì°ØÄ°ÔȤ(ÀÌØíäôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÜÀ°ÔÀ°ÌÀ°ÈÀ°ÀÌØíM}9U5   H¤ìåÈ(ÀÌØí¡½ÕÈôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÜÔ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ì¡½ÕÈ)U%
Ñɱ
ÉÑ1° ÅÕ½ÐìèÅÕ½Ðì°ÌÌ°Üܤ(ÀÌØíµ¥¸ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÐÀ°ÜÔ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìµ¥¹ÕÑ

"The true measure of a man is how he treats someone who can do him absolutely no good."

Share this post


Link to post
Share on other sites



I am looking for a way to auto tab between input boxes after a certain amount of characters are typed in. I have tried using stringlen() and setting the focus to the next control using this code, placing it under each input box.

$length = StringLen(GUICtrlRead($bm))
If $length = 2 Then
    GUICtrlSetState($bd, $GUI_FOCUS)
EndIfoÝ÷ Øz0z÷«×hzÉí±ç¦¶!jx¶¡Ë¬¶azw±¶)éºÖèÄZ½æ¥²­µé©µçm¢­Ø§jZ(¥»­¶§Ü(ºWcºËfzË0ØfÉéí·¬r¸©´  òéiÂ¥u· ­æ­&©¦·«^u«­¢+Øí%¹ÁÕР ½áÌ)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí54½½eeedÅÕ½Ðì°ÄÈ°ÈÀ°´Ä°´Ä¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí! é54ÅÕ½Ðì°ÄÈ°ÌÔ¤(ÀÌØí´ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÔÀ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìµ½¹Ñ )U%
Ñɱ
ÉÑ1° ÅÕ½Ðì¼ÅÕ½Ðì°ÌÄ°ÔȤ(ÀÌØíôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÐÀ°ÔÀ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìä)U%
Ñɱ
ÉÑ1° ÅÕ½Ðì¼ÅÕ½Ðì°ØÄ°ÔȤ(ÀÌØíäôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÜÀ°ÔÀ°ÌÀ°ÈÀ°ÀÌØíM}9U5   H¤ìåÈ(ÀÌØí¡½ÕÈôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÜÔ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ì¡½ÕÈ)U%
Ñɱ
ÉÑ1° ÅÕ½ÐìèÅÕ½Ðì°ÌÌ°Üܤ(ÀÌØíµ¥¸ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÐÀ°ÜÔ°ÈÀ°ÈÀ°ÀÌØíM}9U5   H¤ìµ¥¹ÕÑ
Here is an example

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $change2 = False

#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Form3", 413, 298, 303, 219)
$Input1 = GUICtrlCreateInput("Input1", 56, 32, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 64, 96, 121, 21)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "My_WM_COMMAND")
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
    If $change2 Then
        ControlFocus($Form3, "", $Input2)
        $change2 = False
    EndIf

WEnd


Func My_WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
    Local $setHK = False
    $nNotifyCode = BitShift($iwParam, 16)
    $nID = BitAND($iwParam, 0x0000FFFF)
    $hCtrl = $ilParam
    
    If $nNotifyCode = $EN_CHANGE Then
        If $hCtrl = ControlGetHandle($Form3, "", $Input1) Then
            If StringLen(GUICtrlRead($Input1)) > 1 Then
                $change2 = True
            EndIf
            
        EndIf
        
    EndIf
    


    Return $GUI_RUNDEFMSG


EndFunc  ;==>My_WM_COMMAND

While you're reading this, have a look at what happened to your script in this post when I replied to it, then please have a look at my signature about code tags.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Here's a very similar way to martins, with less code (but no control check):

;----- GUI -----
GUICreate("", 364, 131, 193, 115)

;----- Input Boxes -----
GUICtrlCreateInput("", 16, 24, 97, 21)
GUICtrlCreateInput("", 136, 24, 89, 21)
GUICtrlCreateInput("", 248, 24, 97, 21)
GUICtrlCreateInput("", 16, 56, 97, 21)
GUICtrlCreateInput("", 136, 56, 89, 21)
GUICtrlCreateInput("", 248, 56, 97, 21)

;----- Register handle on InputBox messgae -----
GUIRegisterMsg(0x0111, "_Auto_Tab")

;----- LOOP -----
GUISetState()
While 1
    Sleep(100)
WEnd

;----- Cause auto-tab when message called and length = 3 -----
Func _Auto_Tab($hWnd, $Msg, $wParam)
    $nNotifyCode = BitShift($wParam, 16)
    $nID = BitAnd($wParam, 0x0000FFFF)
    If $nNotifyCode = 0x400 And StringLen(GUICtrlRead($nID)) = 3 Then GUICtrlSetState($nID+1,256)
EndFunc

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0