Jump to content

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)
    Endif
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

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

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

Snappie?

Edited by xzaz
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...