GUISetOnEvent的问题
本帖最后由 newx 于 2009-11-19 03:46 编辑GUISetOnEvent怎么就不灵了呢?
找不出原因,可能我搞的头混了,点按钮后不起作用了,Why?#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $Form1, $SB, $DownARB, $EB
$Form1 = GUICreate("Test", 605, 351)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "Event" )
$SB = GUICtrlCreateButton("扫描", 240, 312, 105, 25)
GUISetOnEvent ( $SB, "Event" )
$DownARB = GUICtrlCreateButton("下载", 360, 312, 121, 25)
GUISetOnEvent ( $DownARB, "Event" )
$EB = GUICtrlCreateButton("退 出", 496, 312, 97, 25)
GUISetOnEvent ( $EB, "Event" )
GUISetState(@SW_SHOW)
While 1
Sleep(10)
WEnd
Func Event()
Switch @GUI_CtrlId
Case $EB
Exit
Case $GUI_EVENT_CLOSE
Exit
Case $SB
SysSearch()
Case $DownARB
nDownload()
EndSwitch
EndFunc
Func nDownload()
;下载
EndFunc
Func SysSearch()
;扫描
EndFunc GUICtrlSetOnEvent ...#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $Form1, $SB, $DownARB, $EB
$Form1 = GUICreate("Test", 605, 351)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event")
$SB = GUICtrlCreateButton("扫描", 240, 312, 105, 25)
GUICtrlSetOnEvent($SB, "Event")
$DownARB = GUICtrlCreateButton("下载", 360, 312, 121, 25)
GUICtrlSetOnEvent($DownARB, "Event")
$EB = GUICtrlCreateButton("退 出", 496, 312, 97, 25)
GUICtrlSetOnEvent($EB, "Event")
GUISetState(@SW_SHOW)
While 1
Sleep(10)
WEnd
Func Event()
Switch @GUI_CtrlId
Case $EB
Exit
Case $GUI_EVENT_CLOSE
Exit
Case $SB
SysSearch()
Case $DownARB
nDownload()
EndSwitch
EndFunc ;==>Event
Func nDownload()
MsgBox(0, 0, '下载')
EndFunc ;==>nDownload
Func SysSearch()
MsgBox(0, 0, '扫描')
EndFunc ;==>SysSearch GUICtrlSetOnEvent 和 GUISetOnEvent
晕,谢谢二楼
头大了头大了…… 控件和窗体事件设置函数不一样的
页:
[1]