Function Reference


GUICtrlSetLimit

Limits the number of characters/pixels for a control.

GUICtrlSetLimit ( controlID, max [, min = 0] )

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate...() function, or -1 for the last created control.
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: 1.
Failure: 0.

Related

GUICtrlCreateEdit, GUICtrlCreateInput, GUICtrlCreateList, GUICtrlCreateSlider, GUICtrlCreateUpdown

Example

#include <GUIConstantsEx.au3>

Example()

Func Example()
        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(@SW_SHOW)

        ; Loop until the user exits.
        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                ExitLoop

                EndSwitch
        WEnd
EndFunc   ;==>Example