Sets the text limit
#include <GuiEdit.au3>
_GUICtrlEdit_SetLimitText ( $hWnd, $iLimit )
$hWnd | Control ID/Handle to the control |
$iLimit | The maximum number of TCHARs the user can enter |
The _GUICtrlEdit_SetLimitText() function limits only the text the user can enter.
It does not affect 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 by the _GUICtrlEdit_SetText() function.
If an application uses the _GUICtrlEdit_SetText() function to place more text into an edit control than is specified in the _GUICtrlEdit_SetLimitText() function, the user can edit the entire contents of the edit control.
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Create GUI
GUICreate("Edit Get/Set Limit Text (v" & @AutoItVersion & ")", 400, 300)
Local $idEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState(@SW_SHOW)
MsgBox($MB_SYSTEMMODAL, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($idEdit))
MsgBox($MB_SYSTEMMODAL, "Information", "Setting Text Limit")
_GUICtrlEdit_SetLimitText($idEdit, 64000)
MsgBox($MB_SYSTEMMODAL, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($idEdit))
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example