Function Reference


_GUICtrlComboBoxEx_LimitText

Limits the length of the text the user may type into the edit control of a ComboBox

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_LimitText ( $hWnd [, $iLimit = 0] )

Parameters

$hWnd Handle to the control
$iLimit [optional] Limit length of the text

Return Value

None.

Remarks

If the $iLimit parameter is zero, the text length is limited to 0x7FFFFFFE characters.

If the ComboBox does not have the $CBS_AUTOHSCROLL style, setting the text limit to be larger than the size of the edit control has no effect.

The _GUICtrlComboBox_LimitText() function limits only the text the user can enter.
It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control when a string in the ListBox is selected.

The default limit to the text a user can enter in the edit control is 30,000 characters.

Example

#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        Local $hGUI, $hCombo

        ; Create GUI
        $hGUI = GUICreate("ComboBoxEx Limit Text", 400, 300)
        $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100)
        GUISetState(@SW_SHOW)

        ; Add files
        _GUICtrlComboBoxEx_BeginUpdate($hCombo)
        _GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES, False)
        _GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES)
        _GUICtrlComboBoxEx_BeginUpdate($hCombo)
        _GUICtrlComboBoxEx_AddDir($hCombo, @WindowsDir & "\*.exe")
        _GUICtrlComboBoxEx_EndUpdate($hCombo)
        _GUICtrlComboBoxEx_EndUpdate($hCombo)

        ; Limit Text in Edit control
        _GUICtrlComboBoxEx_LimitText($hCombo, 10)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example