找回密码
 加入
搜索
查看: 7991|回复: 3

[AU3基础] 关于GUICtrlCreateInput()

[复制链接]
发表于 2011-5-22 11:27:56 | 显示全部楼层 |阅读模式
GUICtrlCreateInput()的返回有0和1,什么时候返回1,什么时候返回0,我想做一个输入框为空的判断
$Input1 = GUICtrlCreateInput("", 88, 80, 257, 37)

If $Input1 =0 Then                                               
     MsgBox(0,"警告","请输入数据!")                               
EndIf
不对
那该怎么样写
发表于 2011-5-22 11:45:16 | 显示全部楼层
1.需要在gui上面创建这个控件
2.如果想知道有没有输入内容请使用GUICtrlRead
--------------------------------------------------------------------------------

读取指定控件的状态或相关数据.


GUICtrlRead ( 控件ID [, 高级] )
发表于 2011-5-22 11:55:30 | 显示全部楼层
本帖最后由 wsfda 于 2011-5-22 11:57 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 360, 169, 306, 287)
$Input1 = GUICtrlCreateInput("", 80, 56, 193, 21)
$Button1 = GUICtrlCreateButton("OK", 136, 104, 65, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Button1
                        $z = GUICtrlRead ( $Input1)
                        If $z = "" Then 
                                MsgBox("警告","警告","请输入内容")
                        Else
                                MsgBox("提示","您输入了",$z)
                        EndIf
                        
                
                        

        EndSwitch
WEnd
 楼主| 发表于 2011-5-22 12:31:29 | 显示全部楼层
我明白了,谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 05:38 , Processed in 0.078395 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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