yanjerry9133 发表于 2011-5-22 11:27:56

关于GUICtrlCreateInput()

GUICtrlCreateInput()的返回有0和1,什么时候返回1,什么时候返回0,我想做一个输入框为空的判断
$Input1 = GUICtrlCreateInput("", 88, 80, 257, 37)

If $Input1 =0 Then                                               
   MsgBox(0,"警告","请输入数据!")                               
EndIf
不对
那该怎么样写

wsfda 发表于 2011-5-22 11:45:16

1.需要在gui上面创建这个控件
2.如果想知道有没有输入内容请使用GUICtrlRead
--------------------------------------------------------------------------------

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


GUICtrlRead ( 控件ID [, 高级] )

wsfda 发表于 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

yanjerry9133 发表于 2011-5-22 12:31:29

我明白了,谢谢
页: [1]
查看完整版本: 关于GUICtrlCreateInput()