Jump to content
Sign in to follow this  
joboy2k

Character limit in an input box

Recommended Posts

joboy2k

Hey guys. This question has already been asked before but as it was like a year ago I wondered if there still was no better way of doing it other than

http://www.autoitscript.com/forum/index.php?showtopic=102964&st=0&p=730024&hl=Limit%20characters%20in%20an%20input&fromsearch=1&#entry730024

What I'm aiming to do is create a GUI that takes down credit card details from our customer that call up on the phone.

I want to have 4 boxes for the long number on the card.

I want each box to have a limit of 4 characters and I want it to automatically move the attention to the next input box. Is there a way of doing this better then how the link solves it?

Thanks in advance

Share this post


Link to post
Share on other sites
AlmarM

You mean like GUICtrlSetLimit ?


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
joboy2k

yes that answers my limiting question thank you, but i need something that will send out a signal when it hits the limit so i can change the focus to the next input box. any ideas?

Share this post


Link to post
Share on other sites
AlmarM

I tried this, but i'ts not working as is supposed to.

#include <GUIConstants.au3>

Global $LimiReached = False

$GUI = GUICreate("", 500, 500)
$Input1 = GUICtrlCreateInput("", 10, 10, 150, 20)
$Input2 = GUICtrlCreateInput("", 10, 35, 150, 20)

GUICtrlSetLimit($Input1, 10, 0)

GUISetState()
While Sleep(10)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch

    If (StringLen(GUICtrlRead($Input1)) = 10 & $LimiReached = False) Then
        GUICtrlSetState($Input2, $GUI_FOCUS)
        $LimiReached = True
    EndIf

    ConsoleWrite("Length input1: " & StringLen(GUICtrlRead($Input1)) & @CRLF & "Limit reached: " & $LimiReached & @CRLF) ; Weird enough, $LimiReached is set to True without input1 having 10 characters... Weird.
WEnd

Read my comment btw... :blink:


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.