Jump to content

Input box max length and overflow


Recommended Posts

Let's say I have a grid of input boxes, like shown:

; first row
    Global $101 = GUICtrlCreateInput("", 24, 32, 25, 21, -1, $WS_EX_CLIENTEDGE)
    Global $102 = GUICtrlCreateInput("", 56, 32, 25, 21, -1, $WS_EX_CLIENTEDGE)
    Global $103 = GUICtrlCreateInput("", 88, 32, 25, 21, -1, $WS_EX_CLIENTEDGE)
    
; second row
    Global $201 = GUICtrlCreateInput("", 24, 56, 25, 21, -1, $WS_EX_CLIENTEDGE)
    Global $202 = GUICtrlCreateInput("", 56, 56, 25, 21, -1, $WS_EX_CLIENTEDGE)
    Global $203 = GUICtrlCreateInput("", 88, 56, 25, 21, -1, $WS_EX_CLIENTEDGE)

I want each box to contain only one character, and when it gets that character, to overflow to the next one. Many serial number inputs work this way. Like if I have a serial number, SERIAL123456789,and the box's max lengths were 5. I would start typing it, and when I finished typing the A, it would switch to the next box. I checked the forums and help file, and surprisingly didn't find much. I suppose I could do something like:

While 1
If StringLen(GUICtrlRead($101))=1 Then
Send('{Tab}')
EndIf
WEnd

But that isn't elegant at all.

There must be a way to set the max length on an input and have the overflow go on to the next inputs.

Any insight, AutoIt gurus?

---Sparkes.

Link to comment
Share on other sites

Thanks for that, but it will work for only solve half my problem though. l somehow didn't find that function, but oh well, I was only looking at the related functions area and searching. My big problem is the overflow. Once the first box is filled, I want it to automatically move to the next one. Any idea how this can be accomplished?

---Sparkes.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...