Nusratrahman Posted December 29, 2014 Share Posted December 29, 2014 I am using GUICtrlcreateinput to capture phone number in three fields. I would like cursor to move by itself from one filed to next once first field is filled. I have used Mousemove(x,y). This moves the mouse position not the txt cursor position. Any help is appreciated. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2014 Moderators Share Posted December 29, 2014 Nusratrahman,Welcome to the AutoIt forums. Something like this should help: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> ; Sett he character limits for the 3 inputs Global $aInput_Limit[3] = [3, 4, 6], $iIndex = 0 $hGUI = GUICreate("Input Autofocus", 500, 500) $cInput_0 = GUICtrlCreateInput("", 20, 20, 30, 20) GUICtrlSetLimit($cInput_0, $aInput_Limit[0]) $cInput_1 = GUICtrlCreateInput("", 80, 20, 40, 20) GUICtrlSetLimit($cInput_1, $aInput_Limit[1]) $cInput_2 = GUICtrlCreateInput("", 150, 20, 60, 20) GUICtrlSetLimit($cInput_2, $aInput_Limit[2]) $cButton = GUICtrlCreateButton("OK", 75, 60, 40, 25) GUICtrlSetState($cButton, $GUI_DISABLE) ; Register the Windows message GUIRegisterMsg($WM_COMMAND, "On_WM_COMMAND") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $sString = GUICtrlRead($cInput_0) & "-" & GUICtrlRead($cInput_1) & "-" & GUICtrlRead($cInput_2) MsgBox(0, "Result", $sString) EndSwitch WEnd Func On_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) ; What code has been sent $iCode = BitShift($wParam, 16) ; And which control sent it $iID = BitAND($wParam, 0x0000FFFF) ; If it was a change to an input... Switch $iCode Case $EN_UPDATE ; ...then check if input is full If StringLen(GUICtrlRead($iID)) = $aInput_Limit[$iIndex] Then ; If it is, then move to the next input GUICtrlSetState($iID + 1, $GUI_ENABLE) GUICtrlSetState($iID + 1, $GUI_FOCUS) ; And increase the index $iIndex += 1 EndIf EndSwitch EndFunc ;==>On_WM_COMMANDPlease ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nusratrahman Posted December 30, 2014 Author Share Posted December 30, 2014 Thanks. That's what I was looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now