Jump to content
Sign in to follow this  

Limit Characters in Input Control

Recommended Posts

#include <GUIConstants.au3>

$gui = GUICreate("My GUI limit input 3 chars")  ; will create a dialog box that when displayed is centered

$input1 = GUICtrlCreateInput("", 10,20)
GUICtrlSetLimit(-1,3)   ; to limit the entry to 3 chars
$input2 = GuiCtrlCreateInput("",10,50)
GUISetState ()

; Run the GUI until the dialog is closed
While 1
    if StringLen(GUICtrlRead($input1)) = 3 Then
        ControlClick($gui, "", $input2)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Maby there is a better way, but this is one way.

Edit: build some check in. so he dosn't reactivating the inputbox.


Edited by xzaz

Share this post

Link to post
Share on other sites

There is an example floating around that uses an event handler. I think if you look in your AutoIt Includes folder for GUICreateIPAddress there is an example.

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  

  • Create New...