Function Reference

首页  后退  前进

GUICtrlSetLimit

 

设置控件的字符或象素数量限制.

 

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

参数

controlID

使用 GUICtrlCreate...() 创建控件类函数返回的控件标识符, 或设置为 -1 使用前面创建的控件.

max

对于 List 列表控件,此值表示水平滚动的最大长度象素值.

对于 Input(输入框)/Edit(编辑框) 控件,此值表示最多能输入的字符数.

min

[可选] 对于 Slider(滑块) 和 UpDown(上下箭头) 控件, 可以指定最小值. 默认 = 0

返回值

成功:

返回 1.

失败:

返回 0.

相关

GUICtrlCreateEdit, GUICtrlCreateInput, GUICtrlCreateList, GUICtrlCreateSlider, GUICtrlCreateUpdown

函数示例

#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

----------------------------------------