找回密码
 加入
搜索
查看: 6020|回复: 5

[GUI管理] 【已解决】如何限制Input 里面输入的位数

  [复制链接]
发表于 2010-10-5 12:28:46 | 显示全部楼层 |阅读模式
本帖最后由 qq82015930 于 2010-10-5 14:18 编辑

如何限制Input 里面输入的位数 比如限制只能输入10位,如何实现?

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-10-5 12:55:57 | 显示全部楼层
GUICtrlSetLimit($Input, 10)
发表于 2010-10-5 13:59:04 | 显示全部楼层
GUICtrlSetLimit
--------------------------------------------------------------------------------

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


GUICtrlSetLimit ( 控件ID, 最大值 [, 最小值] )




参数

控件ID 控件标识符(控件ID),可由 GUICtrlCreate... 函数的返回值获得.
最大值 对于 List 控件,此值表示能水平滚动的最大长度(以象素为单位).
对于 Input/Edit 控件,此值表示最多能输入的字符数.
最小值 [可选参数] 对于 Slider 和 UpDown 控件您还可以指定最小值.(默认为0)



返回值

成功: 返回值为1.  
失败: 返回值为0.



注意/说明

None.




相关

GUICtrlCreateList, GUICtrlCreateInput, GUICtrlCreateEdit, GUICtrlCreateSlider, GUICtrlCreateUpdown


示例/演示


#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


看看帮助还是有用的!哈哈!
 楼主| 发表于 2010-10-5 14:18:10 | 显示全部楼层
谢谢!~两位版主,
发表于 2010-10-6 11:07:36 | 显示全部楼层
没看帮助吧呵呵
发表于 2010-10-26 17:29:15 | 显示全部楼层
记号一下哈
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-28 17:43 , Processed in 0.085346 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表