Function Reference

GUICtrlSetLimit

Limits the number of characters/pixels for a control.

GUICtrlSetLimit ( controlID, max [, min] )

 

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.
max For List controls it is the extent you can scroll horizontally in pixels.
For Input/Edit controls it is the max number of characters that can be entered.
min [optional] For Slider and UpDown controls you can specify a min value. Default = 0

 

Return Value

Success: Returns 1.
Failure: Returns 0.

 

Remarks

None.

 

Related

GUICtrlCreateList, GUICtrlCreateInput, GUICtrlCreateEdit, GUICtrlCreateSlider, GUICtrlCreateUpdown

 

Example


#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
   
    GUICreate("My GUI limit input 3 chars")  ; will create a dialog box that when displayed is centered

    GUICtrlCreateInput("", 10, 20)
    GUICtrlSetLimit(-1, 3)  ; to limit the entry to 3 chars
   
    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
       
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example