nodozhero Posted October 13, 2005 Share Posted October 13, 2005 Input boxes have an option for the length of input able to be typed. Is there a way to restrict the amount of input in a GuiCtrlCreateInput element, then tab to the next box, like a registration Gui for a program?Thanks in advance. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 13, 2005 Share Posted October 13, 2005 GUICtrlSetLimit SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Sokko Posted October 13, 2005 Share Posted October 13, 2005 (edited) This does what you're looking for (uses beta UDFs for Edit controls). It simulates a situation where a user must enter a 15-character key separated into 5-character segments, though you could easily adapt it for any key and segment size. #include <GUIConstants.au3> #include <GUIEdit.au3> GuiCreate("Enter Registration Code",300,50,@DesktopWidth/2-150,@DesktopHeight/2-25) $i1 = GuiCtrlCreateInput("",10,15,50,20) GuiCtrlSetLimit($i1,5) $i2 = GuiCtrlCreateInput("",70,15,50,20) GuiCtrlSetLimit($i2,5) $i3 = GuiCtrlCreateInput("",130,15,50,20) GuiCtrlSetLimit($i3,5) $b1 = GuiCtrlCreateButton("Next >",190,15,50,20) $b2 = GuiCtrlCreateButton("Exit",250,15,40,20) GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $b2 ExitLoop Case $msg = $b1 MsgBox(0,"Next","This button gets the focus when the last input box is filled.") EndSelect If _GUICtrlEditLineLength($i1) = 5 and _GUICtrlEditGetModify($i1) > 0 Then GuiCtrlSetState($i2,$GUI_FOCUS) _GUICtrlEditSetModify($i1,false) EndIf If _GUICtrlEditLineLength($i2) = 5 and _GUICtrlEditGetModify($i2) > 0 Then GuiCtrlSetState($i3,$GUI_FOCUS) _GUICtrlEditSetModify($i2,false) EndIf If _GUICtrlEditLineLength($i3) = 5 and _GUICtrlEditGetModify($i3) > 0 Then GuiCtrlSetState($b1,$GUI_FOCUS) _GUICtrlEditSetModify($i3,false) EndIf WEnd Edited October 13, 2005 by Sokko Link to comment Share on other sites More sharing options...
nodozhero Posted October 14, 2005 Author Share Posted October 14, 2005 (edited) Thanks. the guictrlsetlimit worked great. Another noob question, how do I get it to tab to the next inputbox after it hits the limit? Edited October 15, 2005 by nodozhero 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